A line chart wrapped around a circle, January at the top and the months running clockwise. Heating and cooling at home peak in opposite seasons, so the two lines point opposite ways.
Wrapping a year around a circle puts December next to January, so a season that runs over New Year stays in one piece. Seasonal patterns become shapes that lean towards their months. To follow a trend across many years, a straight line chart is easier to read.
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
// a vertical layout puts the legend under the chart
layout: root.verticalLayout,
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 months
}));
// heating and cooling two colors apart, not neighbors in the theme
chart.get("colors").set("step", 3);
// Add cursor
// https://www.amcharts.com/docs/v5/charts/radar-chart/#Cursor
var cursor = chart.set("cursor", am5radar.RadarCursor.new(root, {
behavior: "zoomX" // drag around the circle to zoom in on some months
}));
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
var xAxis = chart.xAxes.push(am5xy.DateAxis.new(root, {
maxDeviation: 0.1, // can be panned only 10% past the first and last month
groupData: false, // every month is shown, never merged into longer periods
baseInterval: { // one point per month
timeUnit: "month",
count: 1
},
renderer: am5radar.AxisRendererCircular.new(root, {
minGridDistance: 30 // at least 30px between the month labels
}),
tooltip: am5.Tooltip.new(root, {}) // shows the month under the pointer at the edge
}));
// month names only: the year doesn't matter on a ring that repeats every year
xAxis.get("periodChangeDateFormats")["month"] = "MMM";
xAxis.get("tooltipDateFormats")["month"] = "MMMM"; // the full month name in the axis tooltip
var yAxis = chart.yAxes.push(am5xy.ValueAxis.new(root, {
min: 0, // the center is zero
numberFormat: "#' kWh'", // values shown as "500 kWh"
// the value labels run between December and January, clear of the month names
renderer: am5radar.AxisRendererRadial.new(root, { axisAngle: -105 })
}));
// Create series
// https://www.amcharts.com/docs/v5/charts/radar-chart/#Adding_series
function createSeries(name, field) {
var series = chart.series.push(am5radar.RadarLineSeries.new(root, {
name: name,
xAxis: xAxis,
yAxis: yAxis,
valueYField: field,
valueXField: "date",
tooltip: am5.Tooltip.new(root, {
labelText: "{name}: {valueY} kWh" // the series name and its value
})
}));
series.strokes.template.setAll({
strokeWidth: 2 // a 2px line
});
// a dot on each month
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
})
});
});
return series;
}
var series1 = createSeries("Heating", "heating");
var series2 = createSeries("Cooling", "cooling");
// Add legend: click a name to hide its line
// https://www.amcharts.com/docs/v5/charts/radar-chart/#Legend
var legend = chart.children.push(am5.Legend.new(root, {
centerX: am5.p50, // the legend's middle...
x: am5.p50 // ...at the middle of the chart
}));
legend.data.setAll(chart.series.values);
// Set data: energy a house used for heating and for cooling each month, in kWh (sample data)
// https://www.amcharts.com/docs/v5/charts/radar-chart/#Setting_data
var heating = [820, 700, 520, 300, 120, 30, 10, 15, 80, 280, 540, 760];
var cooling = [0, 0, 10, 40, 120, 320, 480, 450, 230, 60, 10, 0];
var data = [];
// one data item per month of 2025, with both values
for (var i = 0; i < 12; i++) {
data.push({
date: new Date(2025, i, 1).getTime(),
heating: heating[i],
cooling: cooling[i]
});
}
series1.data.setAll(data);
series2.data.setAll(data);
// Animate chart and series in
// https://www.amcharts.com/docs/v5/concepts/animations/#Initial_animation
series1.appear(1000);
series2.appear(1000);
chart.appear(1000, 100);
{
"type": "RadarChart",
"settings": {
"panX": false,
"layout": {
"type": "VerticalLayout"
},
"panY": false,
"wheelX": "panX",
"wheelY": "zoomX",
"cursor": {
"type": "RadarCursor",
"settings": {
"behavior": "zoomX"
},
"properties": {
"lineY": {
"settings": {
"visible": false
}
}
}
},
"colors": {
"type": "ColorSet",
"settings": {
"step": 3,
"passOptions": {
"hue": 0.05,
"saturation": 0,
"lightness": 0
},
"colors": [
{
"type": "Color",
"value": "#67b7dc"
},
{
"type": "Color",
"value": "#6794dc"
},
{
"type": "Color",
"value": "#6771dc"
},
{
"type": "Color",
"value": "#8067dc"
}
],
"reuse": false,
"startIndex": 0,
"stateAnimationDuration": 600
}
}
},
"properties": {
"series": [
"#series-0",
"#series-1"
],
"xAxes": [
"#axis-0"
],
"yAxes": [
"#axis-1"
]
},
"children": [
{
"type": "Legend",
"settings": {
"centerX": {
"type": "Percent",
"value": 50
},
"x": {
"type": "Percent",
"value": 50
}
},
"properties": {
"data": [
"#series-0",
"#series-1"
]
}
}
],
"refs": [
{
"data-0": [
{
"date": 1735682400000,
"heating": 820,
"cooling": 0
},
{
"date": 1738360800000,
"heating": 700,
"cooling": 0
},
{
"date": 1740780000000,
"heating": 520,
"cooling": 10
},
{
"date": 1743454800000,
"heating": 300,
"cooling": 40
},
{
"date": 1746046800000,
"heating": 120,
"cooling": 120
},
{
"date": 1748725200000,
"heating": 30,
"cooling": 320
},
{
"date": 1751317200000,
"heating": 10,
"cooling": 480
},
{
"date": 1753995600000,
"heating": 15,
"cooling": 450
},
{
"date": 1756674000000,
"heating": 80,
"cooling": 230
},
{
"date": 1759266000000,
"heating": 280,
"cooling": 60
},
{
"date": 1761948000000,
"heating": 540,
"cooling": 10
},
{
"date": 1764540000000,
"heating": 760,
"cooling": 0
}
]
},
{
"axis-0": {
"type": "DateAxis",
"settings": {
"maxDeviation": 0.1,
"groupData": false,
"baseInterval": {
"timeUnit": "month",
"count": 1
},
"renderer": {
"type": "AxisRendererCircular",
"settings": {
"minGridDistance": 30
}
},
"tooltip": {
"type": "Tooltip"
}
}
}
},
{
"axis-1": {
"type": "ValueAxis",
"settings": {
"min": 0,
"numberFormat": "##' kWh'",
"renderer": {
"type": "AxisRendererRadial",
"settings": {
"axisAngle": -105
}
}
}
}
},
{
"series-0": {
"type": "RadarLineSeries",
"settings": {
"name": "Heating",
"xAxis": "#axis-0",
"yAxis": "#axis-1",
"valueYField": "heating",
"valueXField": "date",
"tooltip": {
"type": "Tooltip",
"settings": {
"labelText": "{name}: {valueY} kWh"
}
}
},
"properties": {
"data": "#data-0",
"strokes": {
"properties": {
"template": {
"settings": {
"strokeWidth": 2
}
}
}
},
"bullets": [
{
"type": "Bullet",
"settings": {
"sprite": {
"type": "Circle",
"settings": {
"radius": 5,
"fill": "@series.get('fill')"
}
}
}
}
]
}
}
},
{
"series-1": {
"type": "RadarLineSeries",
"settings": {
"name": "Cooling",
"xAxis": "#axis-0",
"yAxis": "#axis-1",
"valueYField": "cooling",
"valueXField": "date",
"tooltip": {
"type": "Tooltip",
"settings": {
"labelText": "{name}: {valueY} kWh"
}
}
},
"properties": {
"data": "#data-0",
"strokes": {
"properties": {
"template": {
"settings": {
"strokeWidth": 2
}
}
}
},
"bullets": [
{
"type": "Bullet",
"settings": {
"sprite": {
"type": "Circle",
"settings": {
"radius": 5,
"fill": "@series.get('fill')"
}
}
}
}
]
}
}
}
]
}