A radar chart, also called a spider or web chart, puts each category on its own spoke and joins the values into one shape. Here, nine countries, one value each.
A radar chart turns a row of values into a shape, so one item’s strong and weak points show at a glance. It works best with five to ten categories that share one scale, like scores or ratings. The order of the spokes changes the shape, so the shape alone shouldn’t carry the message.
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.
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."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://www.amcharts.com/docs/v5/getting-started/#Root_element
var root = am5.Root.new("chartdiv");
// Set themes
// https://www.amcharts.com/docs/v5/concepts/themes/
root.setThemes([
am5themes_Animated.new(root),
am5themes_Responsive.new(root)
]);
// Create chart
// https://www.amcharts.com/docs/v5/charts/radar-chart/
var chart = root.container.children.push(am5radar.RadarChart.new(root, {
panX: false, // no dragging the plot around
panY: false,
wheelX: "panX", // a horizontal wheel or trackpad swipe moves a zoomed view around...
wheelY: "zoomX" // ...and the vertical wheel zooms in on some countries
}));
// Add cursor
// https://www.amcharts.com/docs/v5/charts/radar-chart/#Cursor
var cursor = chart.set("cursor", am5radar.RadarCursor.new(root, {
// drag around the circle to zoom in on a few countries
behavior: "zoomX"
}));
cursor.lineY.set("visible", false); // no circle through the pointer, only the line from the center
// Create axes and their renderers
// https://www.amcharts.com/docs/v5/charts/radar-chart/#Adding_axes
// a small minGridDistance keeps every country's name, also on a small chart
var xRenderer = am5radar.AxisRendererCircular.new(root, {
minGridDistance: 20
});
xRenderer.labels.template.setAll({
radius: 10 // the country names sit 10px outside the circle
});
var xAxis = chart.xAxes.push(am5xy.CategoryAxis.new(root, {
maxDeviation: 0, // can't be zoomed or panned past the first or last country
categoryField: "country",
renderer: xRenderer,
tooltip: am5.Tooltip.new(root, {}) // shows the country under the pointer at the edge
}));
var yAxis = chart.yAxes.push(am5xy.ValueAxis.new(root, {
renderer: am5radar.AxisRendererRadial.new(root, {})
}));
// Create series
// https://www.amcharts.com/docs/v5/charts/radar-chart/#Adding_series
var series = chart.series.push(am5radar.RadarLineSeries.new(root, {
name: "Series",
xAxis: xAxis,
yAxis: yAxis,
valueYField: "litres",
categoryXField: "country",
tooltip:am5.Tooltip.new(root, {
labelText:"{valueY}" // just the value
})
}));
series.strokes.template.setAll({
strokeWidth: 2 // a 2px line
});
// a light fill inside the line, so the shape reads at a glance
series.fills.template.setAll({
visible: true,
fillOpacity: 0.2
});
// a dot on each country's value
series.bullets.push(function () {
return am5.Bullet.new(root, {
sprite: am5.Circle.new(root, {
radius: 5, // 5px dots
fill: series.get("fill") // the series color
})
});
});
// Set data
// https://www.amcharts.com/docs/v5/charts/radar-chart/#Setting_data
var data = [{
"country": "Lithuania",
"litres": 501
}, {
"country": "Czechia",
"litres": 301
}, {
"country": "Ireland",
"litres": 266
}, {
"country": "Germany",
"litres": 165
}, {
"country": "Australia",
"litres": 139
}, {
"country": "Austria",
"litres": 336
}, {
"country": "UK",
"litres": 290
}, {
"country": "Belgium",
"litres": 325
}, {
"country": "The Netherlands",
"litres": 40
}];
series.data.setAll(data);
xAxis.data.setAll(data);
// Animate chart and series in
// https://www.amcharts.com/docs/v5/concepts/animations/#Initial_animation
series.appear(1000);
chart.appear(1000, 100);
{
"type": "RadarChart",
"settings": {
"panX": false,
"panY": false,
"wheelX": "panX",
"wheelY": "zoomX",
"cursor": {
"type": "RadarCursor",
"settings": {
"behavior": "zoomX"
},
"properties": {
"lineY": {
"settings": {
"visible": false
}
}
}
}
},
"properties": {
"series": [
"#series-0"
],
"xAxes": [
"#axis-0"
],
"yAxes": [
"#axis-1"
]
},
"refs": [
{
"data-0": [
{
"country": "Lithuania",
"litres": 501
},
{
"country": "Czechia",
"litres": 301
},
{
"country": "Ireland",
"litres": 266
},
{
"country": "Germany",
"litres": 165
},
{
"country": "Australia",
"litres": 139
},
{
"country": "Austria",
"litres": 336
},
{
"country": "UK",
"litres": 290
},
{
"country": "Belgium",
"litres": 325
},
{
"country": "The Netherlands",
"litres": 40
}
]
},
{
"axis-0": {
"type": "CategoryAxis",
"settings": {
"maxDeviation": 0,
"categoryField": "country",
"renderer": {
"type": "AxisRendererCircular",
"settings": {
"minGridDistance": 20
},
"properties": {
"labels": {
"properties": {
"template": {
"settings": {
"radius": 10
}
}
}
}
}
},
"tooltip": {
"type": "Tooltip"
}
},
"properties": {
"data": "#data-0"
}
}
},
{
"axis-1": {
"type": "ValueAxis",
"settings": {
"renderer": {
"type": "AxisRendererRadial"
}
}
}
},
{
"series-0": {
"type": "RadarLineSeries",
"settings": {
"name": "Series",
"xAxis": "#axis-0",
"yAxis": "#axis-1",
"valueYField": "litres",
"categoryXField": "country",
"tooltip": {
"type": "Tooltip",
"settings": {
"labelText": "{valueY}"
}
}
},
"properties": {
"data": "#data-0",
"strokes": {
"properties": {
"template": {
"settings": {
"strokeWidth": 2
}
}
}
},
"fills": {
"properties": {
"template": {
"settings": {
"visible": true,
"fillOpacity": 0.2
}
}
}
},
"bullets": [
{
"type": "Bullet",
"settings": {
"sprite": {
"type": "Circle",
"settings": {
"radius": 5,
"fill": "@series.get('fill')"
}
}
}
}
]
}
}
}
]
}