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
// create a stage
3
var stage = anychart.graphics.create("container");
4
5
// create data
6
var data = [
7
{x: "A", value: 637166},
8
{x: "B", value: 721630},
9
{x: "C", value: 148662},
10
{x: "D", value: 78662},
11
{x: "E", value: 90000}
12
];
13
14
// create and configure the first pie chart
15
var pie1 = anychart.pie(data);
16
pie1.title("Descending Order");
17
pie1.bounds(0, 0, "33.3%", "100%");
18
// set the sorting mode
19
pie1.sort("desc");
20
// disable the legend
21
pie1.legend(false);
22
// set the chart container
23
pie1.container(stage);
24
// initiate drawing the chart
25
pie1.draw();
26
27
// create and configure second pie chart
28
var pie2 = anychart.pie(data);
29
pie2.title("Ascending Order");
30
pie2.bounds("33.3%", 0, "33.3%", "100%");
31
// set the sorting mode
32
pie2.sort("asc");
33
// disable the legend
34
pie2.legend(false);
35
// set the chart container
36
pie2.container(stage);
37
// initiate drawing the chart
38
pie2.draw();
39
40
// create and configure the third pie chart
41
var pie3 = anychart.pie(data);
42
pie3.title("No Sorting");
43
pie3.bounds("66.6%", 0, "33.3%", "100%");
44
// set the sorting mode
45
pie3.sort("none");
46
// disable the legend
47
pie3.legend(false);
48
// set the chart container
49
pie3.container(stage);
50
// initiate drawing the chart
51
pie3.draw();
52
});