The example file is here.
<script> window.onload = function () { // ID, MINIMUM, MAXIMUM, INDICATED VALUE var odo = new RGraph.Odometer('myOdo', 0, 100, 18); odo.Set('chart.green.max', 75); odo.Set('chart.red.min', 90); odo.Set('chart.label.space', 50); odo.Set('chart.needle.thickness', 2); odo.Draw(); } </script>
Note
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, chart.yellow.end, chart.red.start and chart.red.end have all been replaced by chart.green.max and chart.red.min. Now the green area always starts at zero and goes to chart.green.max, and the red area starts at 90% of the maximum value and goes to the maximum value. The yellow area is between the two.You can use these properties to control how the bar graph apears. You can set these properties using the Set() method.
chart.gutter | The width of the area outside the odometer. Default: 25 |
chart.green.max | This is the point at which the green area ends. Default: 75% of the maximum value |
---|---|---|---|
chart.red.min | This is the point at which the red area starts. The yellow area is between the green and red areas. Default: 90% of the maximum value |
chart.label.area | The width of the area that labels are put in. Default: 35 |
chart.needle.thickness | How thick the needle is. Default: 2 |
chart.needle.style | The style that is applied to the needle. Default: #000 |
chart.needle.head | This controls whether the arrow head on the end of the needle is displayed. Default: true |
chart.title | The title text. Default: no title set |
chart.title.color | The color of the title. Default: black |
chart.title.vpos | 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. Default: null |
chart.value | The indicated value Default: none - must be given - also an argument to the constructor |
chart.start | The start value. Default: none - must be given - also an argument to the constructor |
chart.end | The end value. Default: none - must be given - also an argument to the constructor |
chart.shadow.inner | Whether a drop shadow is applied to the inner circle of the Odometer Default: false |
chart.shadow.outer | Whether a drop shadow is applied to the whole Odometer. Default: false |
chart.text.size | The size of the text (in points). Default: 10 |
chart.text.font | The font used to render the text. Default: Verdana |
chart.text.color | The color of the labels. Default: black |
chart.contextmenu | An array of context menu items. More information on context menus is here. Default: [] (An empty array) |
chart.annotatable | Whether annotations are enabled for the chart (ie you can draw on the chart interactively. Default: false |
chart.annotate.color | If you do not allow the use of the palette, then this will be the only colour allowed for annotations. Default: black |
chart.zoom.mode | Can be used to control whether the zoom is in thumbnail or canvas mode. Possible values are: thumbnail and canvas. Default: canvas |
chart.zoom.factor | This is the factor that the graph will be zoomed by (bigger values means more zoom) Default: 1.5 |
chart.zoom.fade.in | Whether the zoomed canvas fades in or not. This also can be used to control the fade in for the zoom in thumbnail mode. Default: true |
chart.zoom.fade.out | Whether the zoomed canvas fades out or not. This also can be used to control the fade in for the zoom in thumbnail mode. Default: true |
chart.zoom.hdir | The horizontal direction of the zoom. Possible values are: left, center, right Default: right |
chart.zoom.vdir | The vertical direction of the zoom. Possible values are: up, center, down Default: down |
chart.zoom.delay | The delay (in milliseconds) between frames. Default: 50 |
chart.zoom.frames | The number of frames in the zoom animation. Default: 10 |
chart.zoom.shadow | Whether or not the zoomed canvas has a shadow or not. Default: true |
chart.zoom.thumbnail.width | When the zoom is in thumbnail mode, this is the width (in pixels) of the thumbnail. Default: 75 |
chart.zoom.thumbnail.height | When the zoom is in thumbnail mode, this is the height (in pixels) of the thumbnail. Default: 75 |
chart.zoom.background | Defaulting to true, this determines whether the zoom has a dark, semi-opaque background that covers the entire web page. Default: true |