HTMLcopy
1
<div id="container"></div>
CSScopy
6
1
html, body, #container {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
3
// create a data set
4
var chartData = {
5
header: ['#', 'Robert Lewandowski', 'Cristiano Ronaldo', 'Lionel Messi'],
6
rows: [
7
['2017', 33, 19, 40],
8
['2018', 24, 36, 34],
9
['2019', 31, 17, 34],
10
['2020', 32, 33, 19],
11
['2021', 43, 25, 24],
12
['2022', 29, 11, 12]
13
]
14
};
15
16
// create a radar chart
17
var chart = anychart.radar();
18
19
// set the series type
20
chart.defaultSeriesType('area');
21
22
// set the chart data
23
chart.data(chartData);
24
25
// set the color palette
26
chart.palette(['#E5593499', '#9BC53DE6', '#64B5F6BF']);
27
28
// configure the appearance of the y axis
29
chart.yAxis().stroke('#545f69');
30
chart.yAxis().ticks().stroke('#545f69');
31
32
// configure the stroke of the x grid
33
chart.xGrid().stroke({
34
color: "#545f69",
35
thickness: 0.5,
36
dash: "10 5"
37
});
38
39
// configure the appearance of the y grid
40
chart.yGrid().palette(['gray 0.05', 'gray 0.025']);
41
42
// set the y scale ticks interval
43
chart.yScale().ticks().interval(10);
44
45
// set the hover mode
46
chart.interactivity().hoverMode('by-x');
47
48
// set the marker type
49
chart.markerPalette(['star5']);
50
51
// improve the tooltip
52
chart.tooltip()
53
.displayMode('union')
54
.useHtml(true)
55
.format(function(e){
56
console.log(this);
57
return '<span style="color:' + this.series.color() + '">' +
58
this.seriesName + ": " + this.value + "</span>"
59
});
60
61
// set the chart title
62
chart.title("Total Goals for Clubs");
63
64
// set the container id
65
chart.container('container');
66
67
// display the radar chart
68
chart.draw();
69
70
});