$(() => {
const maxDay = dataSource
.reduce((prev, current) => (prev.day >= current.day ? prev : current));
const minNight = dataSource
.reduce((prev, current) => (prev.night <= current.night ? prev : current));
$('#radarChart').dxPolarChart({
dataSource,
commonSeriesSettings: {
type: 'bar',
opacity: 0.75,
},
series: [
{ valueField: 'day', name: 'Day', color: '#fdff5e' },
{ valueField: 'night', name: 'Night', color: '#0f3b59' },
],
commonAnnotationSettings: {
type: 'text',
opacity: 0.7,
arrowLength: 0,
},
annotations: [{
text: 'WINTER',
angle: 45,
radius: 180,
}, {
text: 'SPRING',
angle: 135,
radius: 180,
}, {
text: 'SUMMER',
angle: 225,
radius: 180,
}, {
text: 'FALL',
angle: 315,
radius: 180,
}, {
argument: maxDay.arg,
series: 'Day',
text: `Highest temperature: ${maxDay.day} °C`,
opacity: 1,
offsetX: 105,
paddingTopBottom: 15,
paddingLeftRight: 15,
}, {
argument: minNight.arg,
series: 'Night',
text: `Lowest temperature: ${minNight.night} °C`,
opacity: 1,
offsetX: 105,
paddingTopBottom: 15,
paddingLeftRight: 15,
}],
argumentAxis: {
strips: [{
startValue: 'December',
endValue: 'February',
color: '#0076d1',
}, {
startValue: 'March',
endValue: 'May',
color: '#3ca3b0',
}, {
startValue: 'June',
endValue: 'August',
color: '#3fbc1e',
}, {
startValue: 'September',
endValue: 'November',
color: '#f0bb00',
}],
},
legend: {
horizontalAlignment: 'center',
verticalAlignment: 'bottom',
},
title: 'Average temperature in London',
});
});
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>DevExtreme Demo</title>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0" />
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>window.jQuery || document.write(decodeURIComponent('%3Cscript src="js/jquery.min.js"%3E%3C/script%3E'))</script>
<link rel="stylesheet" type="text/css" href="https://cdn3.devexpress.com/jslib/22.2.6/css/dx.light.css" />
<script src="https://cdn3.devexpress.com/jslib/22.2.6/js/dx.all.js"></script>
<script src="data.js"></script>
<link rel="stylesheet" type="text/css" href="styles.css" />
<script src="index.js"></script>
</head>
<body class="dx-viewport">
<div class="demo-container">
<div id="radarChart"></div>
</div>
</body>
</html>
#radarChart {
height: 600px;
}
const dataSource = [{
arg: 'December',
day: 7,
night: 3,
}, {
arg: 'January',
day: 6,
night: 2,
}, {
arg: 'February',
day: 7,
night: 3,
}, {
arg: 'March',
day: 10,
night: 3,
}, {
arg: 'April',
day: 14,
night: 5,
}, {
arg: 'May',
day: 18,
night: 8,
}, {
arg: 'June',
day: 21,
night: 11,
}, {
arg: 'July',
day: 22,
night: 13,
}, {
arg: 'August',
day: 21,
night: 13,
}, {
arg: 'September',
day: 19,
night: 11,
}, {
arg: 'October',
day: 15,
night: 8,
}, {
arg: 'November',
day: 10,
night: 4,
}];