A customised Gauge chart
Here's an example of the canvas Gauge chart which is just one of the various meter-type charts that's available with RGraph. These charts are:
- Fuel (canvas)
- Gauge (canvas)
- Horizontal Progress bar (canvas)
- Meter (canvas)
- Odometer (canvas)
- Semi-circular progress (canvas)
- Thermometer (canvas)
- Vertical Progress bar (canvas)
- Gauge (SVG)
- Semi-circular progress (SVG)
As you can see - there are far more canvas-based meters than SVG ones. Though you can quite easily configure the vertical and horizontal SVG Bar charts to appear as progress bars. There are demos of this being done in the download archive. There's also a demo available of a Pie chart being configured as a progress gauge and other meters here, here, here, here and here
Regarding this chart, the top and bottom titles are being configured, the colors for the banding around the Gauge are being set with specific ranges, there are multiple needles - each with its own color and the tickmarks are being configured.
As you can see it looks quite different to the standard Gauge!
responsive() function in this case doesn't change the appearance or size of the
chart but instead changes the CSS so the
float is removed from the canvas and
parent DIV and the alignment of the parent is changed to be center aligned.
This goes in the documents header:
<script src="RGraph.common.core.js"></script> <script src="RGraph.gauge.js"></script>Put this where you want the chart to show up:
<div style="float: right"> <canvas id="cvs" width="300" height="300">[No canvas support]</canvas> </div>This is the code that generates the chart - it should be placed AFTER the canvas tag(s):