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
["A", 90, 32, 58],
6
["B", 65, 73, 42],
7
["C", 73, 23, 95],
8
["D", 88, 82, 41],
9
["E", 75, 30, 71],
10
["F", 100, 100, 80]
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
var seriesData_3 = data.mapAs({x: 0, value: 3});
17
18
// create a chart
19
var chart = anychart.polar();
20
21
// enable the value stacking mode
22
chart.yScale().stackMode("value");
23
24
// set the type of the x-scale
25
chart.xScale("ordinal");
26
27
// enable sorting points by x
28
chart.sortPointsByX(true);
29
30
// create polygon series, set the data
31
var series1 = chart.polygon(seriesData_1);
32
var series2 = chart.polygon(seriesData_2);
33
var series3 = chart.polygon(seriesData_3);
34
35
// configure tooltips
36
chart.tooltip().format("{%value} ({%yPercentOfCategory}{decimalsCount:2}%)");
37
38
// configure labels on the y-axis
39
chart.yAxis().labels().format("{%value}");
40
41
// set the chart title
42
chart.title("Stacked Polygon Chart");
43
44
// set the container id
45
chart.container("container");
46
47
// initiate drawing the chart
48
chart.draw();
49
});