1 | <?php ob_start('ob_gzhandler') ?> |
---|
2 | <!DOCTYPE html> |
---|
3 | <html> |
---|
4 | <head> |
---|
5 | <meta http-equiv="X-UA-Compatible" content="chrome=1"> |
---|
6 | <!-- |
---|
7 | /** |
---|
8 | * o------------------------------------------------------------------------------o |
---|
9 | * | This file is part of the RGraph package - you can learn more at: | |
---|
10 | * | | |
---|
11 | * | http://www.rgraph.net | |
---|
12 | * | | |
---|
13 | * | This package is licensed under the RGraph license. For all kinds of business | |
---|
14 | * | purposes there is a small one-time licensing fee to pay and for non | |
---|
15 | * | commercial purposes it is free to use. You can read the full license here: | |
---|
16 | * | | |
---|
17 | * | http://www.rgraph.net/LICENSE.txt | |
---|
18 | * o------------------------------------------------------------------------------o |
---|
19 | */ |
---|
20 | --> |
---|
21 | <title>RGraph: Javascript charts and graph library - In-graph labels</title> |
---|
22 | |
---|
23 | <meta name="keywords" content="rgraph html5 canvas charts docs ingraph in-graph" /> |
---|
24 | <meta name="description" content="RGraph: Javascript charts and graph library - Documentation about in-graph labels" /> |
---|
25 | |
---|
26 | <meta property="og:title" content="RGraph: Javascript charts and graph library" /> |
---|
27 | <meta property="og:description" content="A charts library based on the HTML5 canvas tag" /> |
---|
28 | <meta property="og:image" content="http://www.rgraph.net/images/logo.jpg"/> |
---|
29 | |
---|
30 | <link rel="stylesheet" href="../css/website.css" type="text/css" media="screen" /> |
---|
31 | <link rel="icon" type="image/png" href="../images/favicon.png"> |
---|
32 | |
---|
33 | <script src="../libraries/RGraph.common.core.js" ></script> |
---|
34 | <script src="../libraries/RGraph.line.js" ></script> |
---|
35 | <script src="../libraries/RGraph.bar.js" ></script> |
---|
36 | <script src="../libraries/RGraph.scatter.js" ></script> |
---|
37 | |
---|
38 | <script> |
---|
39 | var _gaq = _gaq || []; |
---|
40 | _gaq.push(['_setAccount', 'UA-54706-2']); |
---|
41 | _gaq.push(['_trackPageview']); |
---|
42 | |
---|
43 | (function() { |
---|
44 | var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; |
---|
45 | ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; |
---|
46 | var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); |
---|
47 | })(); |
---|
48 | </script> |
---|
49 | |
---|
50 | </head> |
---|
51 | <body> |
---|
52 | |
---|
53 | |
---|
54 | <!-- Social networking buttons --> |
---|
55 | <div id="social_icons" class="warning" style="border-radius: 10px; top: 1px; position: fixed"> |
---|
56 | <a title="Bookmark with delicious" href="http://delicious.com/save?jump=close&v=4&noui&jump=close&url=http://www.rgraph.net¬es=RGraph%20is%20a%20HTML5%20based%20javascript%20charts%20library%20supporting%20a%20wide%20range%20of%20different%20charts%20types&title=RGraph:Javascript%20charts%20and%20graphs%20library" target="_blank"><img src="../images/delicious.png" alt="Bookmark with delicious" width="22" height="22" border="0" align="absmiddle" /></a> |
---|
57 | <a href="http://twitter.com/home/?status=RGraph%3A%20Javascript+charts+and+graph+library+http%3A%2F%2Fwww.rgraph.net+%23rgraph+%23html5+%23canvas+%23javascript+%23charts+@_rgraph" target="_blank"><img src="../images/twitter.png" id="twitter_icon" alt="tweet this site" width="22" height="22" border="0" align="absmiddle" /></a> |
---|
58 | </div> |
---|
59 | |
---|
60 | <script> |
---|
61 | // Opera fix |
---|
62 | if (navigator.userAgent.indexOf('Opera') == -1) { |
---|
63 | document.getElementById("social_icons").style.position = 'fixed'; |
---|
64 | } |
---|
65 | </script> |
---|
66 | <!-- Social networking buttons --> |
---|
67 | |
---|
68 | <div id="breadcrumb"> |
---|
69 | <a href="../index.html">RGraph: Javascript charts and graph library</a> |
---|
70 | > |
---|
71 | <a href="index.html">Documentation</a> |
---|
72 | > |
---|
73 | In-graph labels |
---|
74 | </div> |
---|
75 | |
---|
76 | <h1>RGraph: <span>Javascript charts and graph library</span> - In-graph labels</h1> |
---|
77 | |
---|
78 | <script> |
---|
79 | if (RGraph.isIE8()) { |
---|
80 | document.write('<div style="background-color: #fee; border: 2px dashed red; padding: 5px"><b>Important</b><br /><br /> Internet Explorer 8 does not natively support the HTML5 canvas tag, so if you want to see the charts, you can either:<ul><li>Install <a href="http://code.google.com/chrome/chromeframe/">Google Chrome Frame</a></li><li>Use ExCanvas. This is provided in the RGraph Archive.</li><li>Use another browser entirely. Your choices are Firefox 3.5+, Chrome 2+, Safari 4+ or Opera 10.5+. </li></ul> <b>Note:</b> Internet Explorer 9 fully supports the canvas tag. Click <a href="http://support.rgraph.net/message/rgraph-in-internet-explorer-9.html" target="_blank">here</a> to see some screenshots.</div>'); |
---|
81 | } |
---|
82 | </script> |
---|
83 | |
---|
84 | <br /> |
---|
85 | |
---|
86 | <p> |
---|
87 | This page shows the various options for in-graph labels. The in-graph labels can be set like this: |
---|
88 | </p> |
---|
89 | |
---|
90 | <pre class="code">obj.Set('chart.labels.ingraph', [,,'Hoolio',,'Olga']);</pre> |
---|
91 | |
---|
92 | <p> |
---|
93 | Or like this if you want to be more specific: |
---|
94 | </p> |
---|
95 | |
---|
96 | <pre class="code">obj.Set('chart.labels.ingraph', [,,<span style="color: green">['Hoolio', 'red', 'yellow', -1, 60]</span>,,'Olga']);</pre> |
---|
97 | |
---|
98 | <p> |
---|
99 | The array can consist of: |
---|
100 | </p> |
---|
101 | |
---|
102 | <ul> |
---|
103 | <li>The label text</li> |
---|
104 | <li>The text color</li> |
---|
105 | <li>The background color</li> |
---|
106 | <li>This can be 1 or -1 and denotes whether the label should be above or below the line. This has no effect in Bar or Scatter charts</li> |
---|
107 | <li>The length of the label pointer/arrow</li> |
---|
108 | </ul> |
---|
109 | |
---|
110 | <h4>Example line chart</h4> |
---|
111 | |
---|
112 | <canvas id="line" width="600" height="250">[No canvas support]</canvas> |
---|
113 | <script> |
---|
114 | myGraph = new RGraph.Line('line', [4,5,6,3,2,5,6,4,2,4,1]); |
---|
115 | myGraph.Set('chart.title', 'Line chart with in-graph labels'); |
---|
116 | myGraph.Set('chart.labels', ['Jim','Gail','Hoolio','Kev','Olga','Jimmy','Paul','Jake','John','Fred', 'Jobe']); |
---|
117 | myGraph.Set('chart.labels.ingraph', [,,['Hoolio', 'red', 'yellow', -1, 60],,'Olga']); |
---|
118 | myGraph.Draw(); |
---|
119 | </script> |
---|
120 | |
---|
121 | <h4>Example bar chart</h4> |
---|
122 | |
---|
123 | <canvas id="bar" width="600" height="250">[No canvas support]</canvas> |
---|
124 | <script> |
---|
125 | myGraph = new RGraph.Bar('bar', [4,5,6,3,2,5,6,4,2,4,1]); |
---|
126 | myGraph.Set('chart.colors', ['#fcc']); |
---|
127 | myGraph.Set('chart.title', 'Bar chart with in-graph labels'); |
---|
128 | myGraph.Set('chart.labels', ['Jim','Gail','Hoolio','Kev','Olga','Jimmy','Paul','Jake','John','Fred', 'Jobe']); |
---|
129 | myGraph.Set('chart.labels.ingraph', [,,['Hoolio', 'red', 'yellow', -1, 60],,'Olga']); |
---|
130 | myGraph.Draw(); |
---|
131 | </script> |
---|
132 | |
---|
133 | <canvas id="scatter" width="600" height="250">[No canvas support]</canvas> |
---|
134 | <script> |
---|
135 | myGraph = new RGraph.Scatter('scatter', [[5,15],[24,30],[27,3],[23, 5]], [[4,12]]); |
---|
136 | myGraph.Set('chart.title', 'Scatter chart with in-graph labels'); |
---|
137 | myGraph.Set('chart.labels', ['W1','W2','W3','W4']); |
---|
138 | myGraph.Set('chart.labels.ingraph', [null,null,['Hoolio', 'red', 'yellow', -1, 60],'Olga','Fred']); |
---|
139 | myGraph.Set('chart.xmax', 31); |
---|
140 | myGraph.Draw(); |
---|
141 | </script> |
---|
142 | |
---|
143 | <h4>Example bar chart (arrow variant)</h4> |
---|
144 | |
---|
145 | <canvas id="bar1" width="600" height="250">[No canvas support]</canvas> |
---|
146 | <script> |
---|
147 | myGraph = new RGraph.Bar('bar1', [4,5,6,3,2,5,6,4,2,4,1]); |
---|
148 | myGraph.Set('chart.colors', ['#fcc']); |
---|
149 | myGraph.Set('chart.title', 'Bar chart with in-graph labels (arrow variant)'); |
---|
150 | myGraph.Set('chart.labels', ['Jim','Gail','Hoolio','Kev','Olga','Jimmy','Paul','Jake','John','Fred', 'Jobe']); |
---|
151 | myGraph.Set('chart.variant', 'arrow'); |
---|
152 | myGraph.Set('chart.labels.ingraph', [,,['Hoolio', 'red', 'yellow', -1, 60],,'Olga']); |
---|
153 | myGraph.Draw(); |
---|
154 | </script> |
---|
155 | |
---|
156 | |
---|
157 | <h4>Example bar chart (dot variant)</h4> |
---|
158 | <canvas id="bar2" width="600" height="250">[No canvas support]</canvas> |
---|
159 | <script> |
---|
160 | myGraph = new RGraph.Bar('bar2', [4,5,6,3,2,5,6,4,2,4,1]); |
---|
161 | myGraph.Set('chart.colors', ['#fcc']); |
---|
162 | myGraph.Set('chart.title', 'Bar chart with in-graph labels (dot variant)'); |
---|
163 | myGraph.Set('chart.labels', ['Jim','Gail','Hoolio','Kev','Olga','Jimmy','Paul','Jake','John','Fred', 'Jobe']); |
---|
164 | myGraph.Set('chart.labels.ingraph', [6,['Foo', 'red', 'yellow', null, 75],3,'Bar']); |
---|
165 | myGraph.Set('chart.variant', 'dot'); |
---|
166 | myGraph.Set('chart.labels.ingraph', [,,['Hoolio', 'red', 'yellow', -1, 60],,'Olga']); |
---|
167 | myGraph.Draw(); |
---|
168 | </script> |
---|
169 | |
---|
170 | </body> |
---|
171 | </html> |
---|