source: Dev/trunk/RGraph/docs/odo.html @ 77

Last change on this file since 77 was 77, checked in by fpvanagthoven, 14 years ago

RGraph

File size: 22.6 KB
Line 
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 - Odometer charts documentation</title>
22   
23    <meta name="keywords" content="rgraph html5 canvas docs odometer charts" />
24    <meta name="description" content="RGraph: Javascript charts and graph library - Documentation about Odometer charts" />
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="/favicon.png">
32   
33    <script src="../libraries/RGraph.common.core.js" ></script>
34
35    <script>
36      var _gaq = _gaq || [];
37      _gaq.push(['_setAccount', 'UA-54706-2']);
38      _gaq.push(['_trackPageview']);
39   
40      (function() {
41        var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
42        ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
43        var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
44      })();
45    </script>
46
47</head>
48<body>
49
50    <!-- Social networking buttons -->
51        <div id="social_icons" class="warning" style="border-radius: 10px; top: 1px; position: fixed">
52            <a title="Bookmark with delicious" href="http://delicious.com/save?jump=close&v=4&noui&jump=close&url=http://www.rgraph.net&notes=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>
53            <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>
54        </div>
55
56        <script>
57            // Opera fix
58            if (navigator.userAgent.indexOf('Opera') == -1) {
59              document.getElementById("social_icons").style.position = 'fixed';
60            }
61        </script>
62    <!-- Social networking buttons -->
63
64    <div id="breadcrumb">
65        <a href="../index.html">RGraph: Javascript charts and graph library</a>
66        >
67        <a href="index.html">Documentation</a>
68        >
69        Odometer charts
70    </div>
71
72    <h1>RGraph: <span>Javascript charts and graph library</span> - Odometer charts documentation</h1>
73
74    <script>
75        if (RGraph.isIE8()) {
76            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>');
77        }
78    </script>
79   
80    <p>
81        The example file is <a href="../examples/odo.html">here</a>.
82    </p>
83   
84    <pre class="code">
85&lt;script&gt;
86    window.onload = function ()
87    {
88        // ID, MINIMUM, MAXIMUM, INDICATED VALUE
89        var odo = new RGraph.Odometer('myOdo', 0, 100, 18);
90       
91        odo.Set('chart.green.max', 75);
92        odo.Set('chart.red.min', 90);
93        odo.Set('chart.label.area', 50);
94        odo.Set('chart.needle.thickness', 2);
95   
96        odo.Draw();
97    }
98&lt;/script&gt;
99</pre>
100   
101    <!--
102        <div class="warning">
103            <p>Note</p>
104             As of 20th March 2010, how you specify the start and end values has changed. The chart.green.start, chart.green.end, chart.yellow.start,
105             chart.yellow.end, chart.red.start and chart.red.end have all been replaced by chart.green.max and chart.red.min. Now the
106             green area always starts at zero and goes to chart.green.max, and the red area starts (by default - you can customise this by using
107             chart.red.min) at 90% of the maximum value and goes to the maximum value. The yellow area is between the two.
108        </div>
109    -->
110
111    <h2>Properties</h2>
112   
113    <p>
114        You can use these properties to control how the Odometer apears. You can set these properties using the <b>Set()</b> method.
115    </p>
116   
117    <ul>
118        <li><a href="#chart configuration">Chart configuration</a></li>
119        <li><a href="#margins">Margins</a></li>
120        <li><a href="#colors">Colors</a></li>
121        <li><a href="#labels and text">Labels and text</a></li>
122        <li><a href="#needle">Needle</a></li>
123        <li><a href="#title">Title</a></li>
124        <li><a href="#shadow">Shadow</a></li>
125        <li><a href="#interactive features">Interactive features</a></li>
126        <li><a href="#zoom">Zoom</a></li><li><a href="#scale">Scale</a></li>
127    </ul>
128
129
130<a name="chart configuration"></a>
131<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Chart configuration</h3>
132
133            <a name="chart.value.text"></a>
134            <b>chart.value.text</b><br />
135            Controls whether the value is indicated as a text label in the center of the dial.<br /><i>Default: false</i><br /><br />
136           
137            <a name="chart.value.units.pre"></a>
138            <b>chart.value.units.pre</b><br />
139            The pre units used on the textual value.<br /><i>Default: nothing (An empty string)</i><br /><br />
140           
141            <a name="chart.value.units.post"></a>
142            <b>chart.value.units.post</b><br />
143            The post units used on the textual value.<br /><i>Default: nothing (An empty string)</i><br /><br />
144           
145            <a name="chart.border"></a>
146            <b>chart.border</b><br />
147            This controls the gray border of the Odometer.<br /><i>Default: false</i><br /><br />
148           
149            <a name="chart.tickmarks.highlighted"></a>
150            <b>chart.tickmarks.highlighted</b><br />
151            This controls whether the tickmarks are highlighted in red/yellow/green.<br /><i>Default: false</i><br /><br />
152           
153            <a name="chart.zerostart"></a>
154            <b>chart.zerostart</b><br />
155            If you want the top value on your chart to be zero instead of the maximum value, set this to true.<br /><i>Default: false</i><br /><br />
156
157<a name="margins"></a>
158<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Margins</h3>
159           
160
161
162
163            <a name="chart.gutter.left"></a>
164            <b>chart.gutter.left</b><br />
165            The left gutter of the chart, (the gutter is where the labels and title are)).<br />
166            <i>Default: 25</i><br /><br />
167
168            <a name="chart.gutter.right"></a>
169            <b>chart.gutter.right</b><br />
170            The right gutter of the chart, (the gutter is where the labels and title are).<br />
171            <i>Default: 25</i><br /><br />
172
173            <a name="chart.gutter.top"></a>
174            <b>chart.gutter.top</b><br />
175            The top gutter of the chart, (the gutter is where the labels and title are).<br />
176            <i>Default: 25</i><br /><br />
177
178            <a name="chart.gutter.bottom"></a>
179            <b>chart.gutter.bottom</b><br />
180            The bottom gutter of the chart, (the gutter is where the labels and title are).<br />
181            <i>Default: 25</i><br /><br />
182
183<a name="colors"></a>
184<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Colors</h3>
185           
186            <a name="chart.border.color1"></a>
187            <b>chart.border.color1</b><br />
188            This is the first color used in the gradient of the outer border of the chart (if enabled).<br />
189            <i>Default: #BEBCB0</i><br /><br />
190           
191            <a name="chart.border.color2"></a>
192            <b>chart.border.color2</b><br />
193            This is the second/middle color used in the gradient of the outer border of the chart (if enabled).<br />
194            <i>Default: #F0EFEA</i><br /><br />
195           
196            <a name="chart.border.color3"></a>
197            <b>chart.border.color3</b><br />
198            This is the third color used in the gradient of the outer border of the chart (if enabled).<br />
199            <i>Default: #BEBCB0</i><br /><br />
200
201            <a name="chart.green.max"></a>
202            <b>chart.green.max</b><br />
203            This is the point at which the green area ends.<br />
204            <i>Default: 75% of the maximum value</i><br /><br />
205
206            <a name="chart.red.min"></a>
207            <b>chart.red.min</b><br />
208            This is the point at which the red area starts. The yellow area is between the green and red areas.<br />
209            <i>Default: 90% of the maximum value</i><br /><br />
210
211            <a name="chart.green.color"></a>
212            <b>chart.green.color</b><br />
213            This option has two roles. If <i>chart.green.solid</i> is true, this is the actual color, whereas if
214            <i>chart.green.solid</i> is false (the default), it's used as one of the gradient colors.<br />
215            <i>Default: green</i><br /><br />
216
217            <a name="chart.yellow.color"></a>
218            <b>chart.yellow.color</b><br />
219            This option has two roles. If <i>chart.yellow.solid</i> is true, this is the actual color, whereas if
220            <i>chart.yellow.solid</i> is false (the default), it's used as one of the gradient colors.<br />
221            <i>Default: yellow</i><br /><br />
222
223            <a name="chart.red.color"></a>
224            <b>chart.red.color</b><br />
225            This option has two roles. If <i>chart.red.solid</i> is true, this is the actual color, whereas if
226            <i>chart.red.solid</i> is false (the default), it's used as one of the gradient colors.<br />
227            <i>Default: red</i><br /><br />
228
229            <a name="chart.green.solid"></a>
230            <b>chart.green.solid</b><br />
231            If <i>true</i> then the associated <i>chart.green.color</i> option is used as the  actual color, not part of a gradient<br />
232            <i>Default: false</i><br /><br />
233
234            <a name="chart.yellow.solid"></a>
235            <b>chart.yellow.solid</b><br />
236            If <i>true</i> then the associated <i>chart.yellow.color</i> option is used as the  actual color, not part of a gradient<br />
237            <i>Default: false</i><br /><br />
238
239            <a name="chart.red.solid"></a>
240            <b>chart.red.solid</b><br />
241            If <i>true</i> then the associated <i>chart.red.color</i> option is used as the  actual color, not part of a gradient<br />
242            <i>Default: false</i><br /><br />
243
244<a name="labels and text"></a>
245<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Labels and text</h3>            <a name="chart.labels"></a>
246<b>chart.labels</b><br />
247            Instead of using computed numbers, which uses the maximum value, you can specify the Odometer to use textual labels instead, with this option.<br /> <i>Default: null</i><br /><br />
248            <a name="chart.label.area"></a>
249<b>chart.label.area</b><br />
250            The width of the area that labels are put in. <br /><i>Default: 35</i><br /><br />
251            <a name="chart.text.size"></a>
252<b>chart.text.size</b><br />
253            The size of the text (in points). <br /><i>Default: 10</i><br /><br />
254            <a name="chart.text.font"></a>
255<b>chart.text.font</b><br />
256            The font used to render the text.<br /><i>Default: Verdana</i><br /><br />
257            <a name="chart.text.color"></a>
258<b>chart.text.color</b><br />
259            The color of the labels. <br /><i>Default: black</i><br /><br />
260<a name="needle"></a>
261<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Needle</h3>            <a name="chart.needle.width"></a>
262<b>chart.needle.width</b><br />
263            How thick the needle is. <br /><i>Default: 2</i><br /><br />
264            <a name="chart.needle.color"></a>
265<b>chart.needle.color</b><br />
266            The color that is applied to the needle. <br /><i>Default: black</i><br /><br />
267            <a name="chart.needle.head"></a>
268<b>chart.needle.head</b><br />
269            This controls whether the arrow head on the end of the needle is displayed. <br /><i>Default: true</i><br /><br />
270           
271            <a name="chart.needle.type"></a>
272            <b>chart.needle.type</b><br />
273            This determines which type of needle is used. It can be <i>pointer</i> or <i>triangle</i>. <br />
274            <i>Default: pointer</i><br /><br />
275           
276            <a name="chart.needle.triangle.border"></a>
277            <b>chart.needle.triangle.border</b><br />
278            This controls the colour of the border for the pointer. If you don't want it you could set it to be transparent -
279            <i>rgba(0,0,0,0)</i>.<br />
280            <i>Default: #aaa</i><br /><br />
281           
282            <a name="chart.needle.extra"></a>
283            <b>chart.needle.extra</b><br />
284            With this you can specify a number of extra pointers that will be drawn on the Odometer. An example would be a meter that's used to show upload and download data. An example use:<pre class="code">odo.Set('chart.needle.extra', [[16, 'red'], [24, 'blue']]);</pre><br />
285            <i>Default: [] (An empty array)</i><br /><br />
286
287<a name="title"></a>
288<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Title</h3>            <a name="chart.title"></a>
289<b>chart.title</b><br />
290            The title text. <br /><i>Default: no title set</i><br /><br />
291
292<a name="chart.title.background"></a>
293<b>chart.title.background</b><br />
294The background color (if any) for the title.<br />
295<i>Default: null</i><br /><br />
296
297            <a name="chart.title.color"></a>
298<b>chart.title.color</b><br />
299            The color of the title.<br /> <i>Default: black</i><br /><br />
300            <a name="chart.title.hpos"></a>
301<b>chart.title.hpos</b><br />
302            This allows you to completely override the horizontal positioning of the title. It should be a number between 0 and 1, and is multiplied with the whole width of the canvas and then used as the horizontal position. <br /><i>Default: null</i><br /><br />
303            <a name="chart.title.vpos"></a>
304<b>chart.title.vpos</b><br />
305            This allows you to completely override the vertical positioning of the title. It should be a number between 0 and 1, and is multiplied with the gutter and then used as the vertical position. It can be useful if you need to have a large gutter.<br /><i>Default: null</i><br /><br />
306<a name="shadow"></a>
307<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Shadow</h3>            <a name="chart.shadow.inner"></a>
308<b>chart.shadow.inner</b><br />
309            Whether a drop shadow is applied to the inner circle of the Odometer<br /><i>Default: false</i><br /><br />
310            <a name="chart.shadow.outer"></a>
311<b>chart.shadow.outer</b><br />
312            Whether a drop shadow is applied to the whole Odometer.<br /><i>Default: false</i><br /><br />
313<a name="interactive features"></a>
314<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Interactive features</h3>            <a name="chart.contextmenu"></a>
315<b>chart.contextmenu</b><br />
316            An array of context menu items. More information on context menus is <a href="context.html">here</a>.<br /><i>Default: [] (An empty array)</i><br /><br />
317            <a name="chart.annotatable"></a>
318<b>chart.annotatable</b><br />
319            Whether annotations are enabled for the chart (ie you can draw on the chart interactively.<br /><i>Default: false</i><br /><br />
320            <a name="chart.annotate.color"></a>
321<b>chart.annotate.color</b><br />
322            If you do not allow the use of the palette, then this will be the only colour allowed for annotations.<br /><i>Default: black</i><br /><br />
323
324
325
326            <a name="chart.resizable"></a>
327            <b>chart.resizable</b><br />
328            Defaulting to false, this determines whether your chart will be resizable. Because of the numerous event handlers this has to install code on, This feature is unlikely to work with other dynamic features (the context menu is fine however).<br />
329            <i>Default: false</i><br /><br />
330
331
332            <a name="chart.resize.handle.background"></a>
333            <b>chart.resize.handle.background</b><br />
334            With this you can specify the background color for the resize handle. If you're adjusting the position of the
335            handle then you may need this to make the handle stand out more.<br />
336            <i>Default: null</i><br /><br />
337
338
339<a name="zoom"></a>
340<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Zoom</h3>            <a name="chart.zoom.mode"></a>
341<b>chart.zoom.mode</b><br />
342            Can be used to control whether the zoom is in thumbnail or canvas mode. Possible values are: <i>thumbnail</i> and <i>canvas</i>.<br /><i>Default: canvas</i><br /><br />
343            <a name="chart.zoom.factor"></a>
344<b>chart.zoom.factor</b><br />
345            This is the factor that the chart will be zoomed by (bigger values means more zoom)<br /><i>Default: 1.5</i><br /><br />
346            <a name="chart.zoom.fade.in"></a>
347<b>chart.zoom.fade.in</b><br />
348            Whether the zoomed canvas fades in or not. This also can be used to control the fade in for the zoom in thumbnail mode.<br /><i>Default: true</i><br /><br />
349            <a name="chart.zoom.fade.out"></a>
350<b>chart.zoom.fade.out</b><br />
351            Whether the zoomed canvas fades out or not. This also can be used to control the fade in for the zoom in thumbnail mode.<br /><i>Default: true</i><br /><br />
352            <a name="chart.zoom.hdir"></a>
353<b>chart.zoom.hdir</b><br />
354            The horizontal direction of the zoom. Possible values are: <i>left</i>, <i>center</i>, <i>right</i><br /><i>Default: right</i><br /><br />
355            <a name="chart.zoom.vdir"></a>
356<b>chart.zoom.vdir</b><br />
357            The vertical direction of the zoom. Possible values are: <i>up</i>, <i>center</i>, <i>down</i><br /><i>Default: down</i><br /><br />
358            <a name="chart.zoom.delay"></a>
359<b>chart.zoom.delay</b><br />
360            The delay (in milliseconds) between frames.<br /><i>Default: 50</i><br /><br />
361            <a name="chart.zoom.frames"></a>
362<b>chart.zoom.frames</b><br />
363            The number of frames in the zoom animation.<br /><i>Default: 10</i><br /><br />
364            <a name="chart.zoom.shadow"></a>
365<b>chart.zoom.shadow</b><br />
366            Whether or not the zoomed canvas has a shadow or not.<br /><i>Default: true</i><br /><br />
367            <a name="chart.zoom.thumbnail.width"></a>
368<b>chart.zoom.thumbnail.width</b><br />
369            When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
370            <a name="chart.zoom.thumbnail.height"></a>
371<b>chart.zoom.thumbnail.height</b><br />
372            When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail.<br /><i>Default: 75</i><br /><br />
373            <a name="chart.zoom.background"></a>
374<b>chart.zoom.background</b><br />
375            Defaulting to true, this determines whether the zoom has a dark, semi-opaque background that covers the entire web page.<br /><i>Default: true</i><br /><br />
376<a name="scale"></a>
377<h3 style="border: 1px solid #aaa; background-color: #eee; font-style: italic; padding: 5px; -moz-border-radius: 10px; -webkit-border-radius: 10px; border-radius: 10px">Scale</h3>
378
379            <a name="chart.units.pre"></a>
380            <b>chart.units.pre</b><br />
381            The units that the value is measured in. This string is displayed BEFORE the actual number, allowing you to specify values such as "$50" and is only used if chart.value.text is <i>true</i>.<br /><i>Default: none</i><br /><br />
382           
383            <a name="chart.units.post"></a>
384            <b>chart.units.post</b><br />
385            The units that the value is measured in. This string is displayed AFTER the actual number, allowing you to specify values such as "50ms" and is only used if chart.value.text is <i>true</i>.<br /><i>Default: none</i><br /><br />
386
387            <a name="chart.scale.decimals"></a>
388<b>chart.scale.decimals</b><br />
389            The number of decimal places to display for the labels.<br /><i>Default: 0</i><br /><br />
390</div><!-- /DOCS --><br /><br />
391
392</body>
393</html>
Note: See TracBrowser for help on using the repository browser.