Mention RGraph on Twitter

RGraph: HTML5 Javascript charts library - Odometer charts documentation

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.area', 50);
        odo.Set('chart.needle.thickness', 2);
    
        odo.Draw();
    }
</script>

Properties

You can use these properties to control how the Odometer apears. You can set these properties using the Set() method.

Chart configuration

chart.value.text
Controls whether the value is indicated as a text label in the center of the dial.
Default: false

chart.value.units.pre
The pre units used on the textual value.
Default: nothing (An empty string)

chart.value.units.post
The post units used on the textual value.
Default: nothing (An empty string)

chart.border
This controls the gray border of the Odometer.
Default: false

chart.tickmarks.highlighted
This controls whether the tickmarks are highlighted in red/yellow/green.
Default: false

chart.zerostart
If you want the top value on your chart to be zero instead of the maximum value, set this to true.
Default: false

Margins

chart.gutter.left
The left gutter of the chart, (the gutter is where the labels and title are)).
Default: 25

chart.gutter.right
The right gutter of the chart, (the gutter is where the labels and title are).
Default: 25

chart.gutter.top
The top gutter of the chart, (the gutter is where the labels and title are).
Default: 25

chart.gutter.bottom
The bottom gutter of the chart, (the gutter is where the labels and title are).
Default: 25

Colors

chart.border.color1
This is the first color used in the gradient of the outer border of the chart (if enabled).
Default: #BEBCB0

chart.border.color2
This is the second/middle color used in the gradient of the outer border of the chart (if enabled).
Default: #F0EFEA

chart.border.color3
This is the third color used in the gradient of the outer border of the chart (if enabled).
Default: #BEBCB0

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.green.color
This option has two roles. If chart.green.solid is true, this is the actual color, whereas if chart.green.solid is false (the default), it's used as one of the gradient colors.
Default: green

chart.yellow.color
This option has two roles. If chart.yellow.solid is true, this is the actual color, whereas if chart.yellow.solid is false (the default), it's used as one of the gradient colors.
Default: yellow

chart.red.color
This option has two roles. If chart.red.solid is true, this is the actual color, whereas if chart.red.solid is false (the default), it's used as one of the gradient colors.
Default: red

chart.green.solid
If true then the associated chart.green.color option is used as the actual color, not part of a gradient
Default: false

chart.yellow.solid
If true then the associated chart.yellow.color option is used as the actual color, not part of a gradient
Default: false

chart.red.solid
If true then the associated chart.red.color option is used as the actual color, not part of a gradient
Default: false

Labels and text

chart.labels
Instead of using computed numbers, which uses the maximum value, you can specify the Odometer to use textual labels instead, with this option.
Default: null

chart.label.area
The width of the area that labels are put in.
Default: 35

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

Needle

chart.needle.width
How thick the needle is.
Default: 2

chart.needle.color
The color that is applied to the needle.
Default: black

chart.needle.head
This controls whether the arrow head on the end of the needle is displayed.
Default: true

chart.needle.type
This determines which type of needle is used. It can be pointer or triangle.
Default: pointer

chart.needle.triangle.border
This controls the colour of the border for the pointer. If you don't want it you could set it to be transparent - rgba(0,0,0,0).
Default: #aaa

chart.needle.extra
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:
odo.Set('chart.needle.extra', [[16, 'red'], [24, 'blue']]);

Default: [] (An empty array)

Title

chart.title
The title text.
Default: no title set

chart.title.font
The font that the title is rendered in. If not specified the chart.text.font setting is used (usually Verdana)
Default: null

chart.title.size
The size of the title. If not specified the size is usually 2pt bigger than the chart.text.size setting.
Default: null

chart.title.bold
Whather the title is bold or not.
Default: true

chart.title.background
The background color (if any) for the title.
Default: null

chart.title.color
The color of the title.
Default: black

chart.title.hpos
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.
Default: null

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

Shadow

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

Interactive features

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.resizable
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).
Default: false

chart.resize.handle.background
With this you can specify the background color for the resize handle. If you're adjusting the position of the handle then you may need this to make the handle stand out more.
Default: null

Zoom

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 chart 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

Scale

chart.units.pre
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 true.
Default: none

chart.units.post
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 true.
Default: none

chart.scale.decimals
The number of decimal places to display for the labels.
Default: 0