Angular Gauge
The classic gauge: a needle on a half-circle dial from 0 to 100, like a speedometer. It shows one value and how far along its range it is.
About this chart
When a gauge works
A gauge shows a single value against its range, the way a speedometer does. It is familiar and quick to read, which makes it a good headline on a dashboard. It takes a lot of room for one number, so keep it for the few values that matter most.
Good for
- One headline KPI on a dashboard
- Live readings: speed, load, temperature
- Scores out of a fixed maximum
Think twice when
- Many values: a bar chart shows them in less space
- Trends: a line chart shows where the value came from
- Values with no fixed range
For developers
Get the code.
Built with amCharts 5, a JavaScript library. The JavaScript includes your theme and renderer (canvas or SVG); the JSON also follows the changes you make with the controls.
For projects that use npm:
How it reads:
npm install @amcharts/amcharts5. See Getting started.
The same chart as a JSON config. Chart Maker reads and writes this format, the library's JSON parser turns it into a chart, and the <am5-chart> element puts it on a page with no code.How it reads:
"type" is the class to create and "settings" what you would pass to its new() in code; "properties" fill in its parts, lists such as series and axes or templates such as columns.template; "refs" holds objects used in more than one place ("#series-0" stands for the one named series-0); a string starting with "@" takes a value from another object, such as "@series.get('fill')".
A complete page. Save it as an .html file and open it in a browser.
Paste this into an AI coding assistant to build the chart from scratch. More in amCharts & AI.
// Create root element
// https://docs.amcharts.com/v5/getting-started/#root-element
var root = am5.Root.new("chartdiv");
// Set themes
// https://docs.amcharts.com/v5/concepts/themes/
root.setThemes([
am5themes_Animated.new(root),
am5themes_Responsive.new(root)
]);
// Create chart
// https://docs.amcharts.com/v5/charts/radar-chart/
var chart = root.container.children.push(am5radar.RadarChart.new(root, {
panX: false, // the gauge doesn't pan when dragged
panY: false,
startAngle: 180, // the arc starts on the left...
endAngle: 360 // ...and goes over the top to the right
}));
// Create axis and its renderer
// https://docs.amcharts.com/v5/charts/radar-chart/gauge-charts/#axes
var axisRenderer = am5radar.AxisRendererCircular.new(root, {
// a negative inner radius counts in from the rim: the grid lines become 10px marks on the edge
innerRadius: -10,
strokeOpacity: 0.1 // a faint line along the arc
});
var xAxis = chart.xAxes.push(am5xy.ValueAxis.new(root, {
maxDeviation: 0, // the scale can't be panned past its ends
min: 0, // the scale runs from 0...
max: 100, // ...to 100
strictMinMax: true, // exactly, not rounded out to nicer numbers
renderer: axisRenderer
}));
// Add clock hand
// https://docs.amcharts.com/v5/charts/radar-chart/gauge-charts/#clock-hands
// the hand is the bullet of an axis range: animating the range's value turns the hand
var axisDataItem = xAxis.makeDataItem({});
axisDataItem.set("value", 0); // the hand starts at 0
var bullet = axisDataItem.set("bullet", am5xy.AxisBullet.new(root, {
sprite: am5radar.ClockHand.new(root, {
radius: am5.percent(99) // the hand reaches almost to the scale
})
}));
xAxis.createAxisRange(axisDataItem);
// hide the range's own grid line, so only the hand shows
axisDataItem.get("grid").set("visible", false);
// every 2 seconds, turn the hand to a random value
setInterval(function () {
axisDataItem.animate({
key: "value",
to: Math.round(Math.random() * 100), // a random value from 0 to 100
duration: 800, // the hand takes 0.8 seconds to turn
easing: am5.ease.out(am5.ease.cubic) // slowing down as it arrives
});
}, 2000);
// Make stuff animate on load
chart.appear(1000, 100);
{
"type": "RadarChart",
"settings": {
"panX": false,
"panY": false,
"startAngle": 180,
"endAngle": 360
},
"properties": {
"xAxes": [
"#axis-0"
]
},
"refs": [
{
"axis-0": {
"type": "ValueAxis",
"settings": {
"maxDeviation": 0,
"min": 0,
"max": 100,
"strictMinMax": true,
"renderer": {
"type": "AxisRendererCircular",
"settings": {
"innerRadius": -10,
"strokeOpacity": 0.1
}
}
}
}
},
{
"axisRange-0": {
"axis": "#axis-0",
"settings": {
"value": 47.269429672779296,
"bullet": {
"type": "AxisBullet",
"settings": {
"sprite": {
"type": "ClockHand",
"settings": {
"radius": {
"type": "Percent",
"value": 99
}
}
}
}
},
"grid": {
"type": "Grid",
"settings": {
"visible": false
}
}
},
"__parseLogic": "axisRange"
}
}
]
}



