Mention RGraph on Twitter

RGraph: HTML5 Javascript charts library - Fuel Gauge documentation

The Fuel gauge is recent addition to RGraph, and the available configuration options are shown here.

The example file is here.

 
<script>
    window.onload = function ()
    {
        fuel = new RGraph.Fuel('cvs', 0, 100, 67);
        fuel.Set('chart.needle.color', 'blue');
        fuel.Set('chart.colors', ['#ddf']);
        fuel.Set('chart.labels.empty', 'Empty!');
        fuel.Set('chart.labels.full', 'Full');
        fuel.Set('chart.icon', '/images/water.jpg');
        fuel.Draw();
    }
</script>

Properties

You can use these properties to control how the Fuel Gauge apears. You can set them by using the Set() method. Eg:

myFuel.Set('name', 'value');

Colors

chart.colors
The color of the Fuel Gauge. Noe that despite there being only one color, this is still an array.
Default: ['red']

Margins

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

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

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

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

Needle options

chart.needle.color
The color of the needle (not including the bulb at the bottom). Note that this is NOT an array - it's just a string.
Default: 'red'

Labels and text

chart.labels.empty
The label used as the empty text.
Default: E

chart.labels.full
The label used as the full text.
Default: F

chart.text.color
The color used for the text on the chart.
Default: F

chart.text.font
The font used for the text.
Default: Verdana

Interactive features

chart.contextmenu
The context menu. For more details see here.
Default: null

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

Miscellaneous

chart.icon
This should be a data: URL that represents the image to use as the icon on the chart. The example page has an example of a chart that uses this option to show a water droplet instead of the fuel pump.
Default: [A fuel icon]