HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
// our data from bulbapedia
3
var data1 = [
4
{x: 'Speed', value: 65},
5
{x: 'HP', value: 39},
6
{x: 'Defense', value: 43},
7
{x: 'Special Defense', value: 50},
8
{x: 'Special Attack', value: 60},
9
{x: 'Attack', value: 52}
10
];
11
12
var data2 = [
13
{x: 'Speed', value: 45},
14
{x: 'HP', value: 45},
15
{x: 'Defense', value: 49},
16
{x: 'Special Defense', value: 65},
17
{x: 'Special Attack', value: 65},
18
{x: 'Attack', value: 49}
19
];
20
21
var data3 = [
22
{x: 'Speed', value: 43},
23
{x: 'HP', value: 44},
24
{x: 'Defense', value: 65},
25
{x: 'Special Defense', value: 64},
26
{x: 'Special Attack', value: 50},
27
{x: 'Attack', value: 48}
28
];
29
30
// create radar chart
31
var chart = anychart.radar();
32
33
// set chart yScale settings
34
chart.yScale()
35
.minimum(35)
36
.maximum(65)
37
.ticks({'interval':5});
38
39
// color alternating cells
40
chart.yGrid().palette(['gray 0.1', 'gray 0.2']);
41
42
// create first series
43
chart.area(data1).name('Charmander').markers(true).fill('#E55934', 0.3).stroke('#E55934');
44
// create second series
45
chart.area(data2).name('Bulbasaur').markers(true).fill('#9BC53D', 0.3).stroke('#9BC53D');
46
// create third series
47
chart.area(data3).name('Squirtle').markers(true).fill('#5BC0EB', 0.3).stroke('#5BC0EB');
48
49
// set chart title
50
chart.title('Starter Pokemon Comparison Chart')
51
// set legend
52
.legend(true);
53
54
// set container id for the chart
55
chart.container('container');
56
// initiate chart drawing
57
chart.draw();
58
});