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 data = anychart.data.set([
5
["Strength", 15, 8],
6
["Dexterity", 10, 14],
7
["Concentration", 15, 14],
8
["Intelligence", 10, 15],
9
["Wisdom", 12, 12],
10
["Charisma", 9, 8]
11
]);
12
13
// map the data
14
var seriesData_1 = data.mapAs({x: 0, value: 1});
15
var seriesData_2 = data.mapAs({x: 0, value: 2});
16
17
// create a chart
18
var chart = anychart.polar();
19
20
// set the type of the x-scale
21
chart.xScale("ordinal");
22
23
// enable sorting points by x
24
chart.sortPointsByX(true);
25
26
// set the inner radius
27
chart.innerRadius(50);
28
29
// set the interactivity mode
30
chart.interactivity().hoverMode("single");
31
32
// create the first series, set the data and name
33
var series1 = chart.polyline(seriesData_1);
34
series1.name("Wizard");
35
36
// configure the visual settings of the first series
37
series1.normal().stroke("#00cc99", 1, "10 5", "round");
38
series1.hovered().stroke("#00cc99", 2, "10 5", "round");
39
series1.selected().stroke("#00cc99", 4, "10 5", "round");
40
41
// create the second series, set the data and name
42
var series2 = chart.polyline(seriesData_2);
43
series2.name("Fighter");
44
45
// configure the visual settings of the second series
46
series2.normal().stroke("#0066cc");
47
series2.hovered().stroke("#0066cc", 2);
48
series2.selected().stroke("#0066cc", 4);
49
50
// set the chart title
51
chart.title("Polyline Chart: Appearance");
52
53
// set the container id
54
chart.container("container");
55
56
// initiate drawing the chart
57
chart.draw();
58
});