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 pie chart with passed data
3
var chart = anychart.pie([
4
['Department Stores', 6371664],
5
['Discount Stores', 7216301],
6
['Men\'s/Women\'s Stores', 1486621],
7
['Juvenile Specialty Stores', 786622],
8
['All other outlets', 900000]
9
]);
10
//set chart title text settings
11
var customLabel = chart.label();
12
customLabel.text('ACME Corp.\napparel sales');
13
customLabel.position('center');
14
customLabel.anchor('center');
15
customLabel.hAlign('center');
16
customLabel.vAlign('middle');
17
customLabel.adjustFontSize(true);
18
customLabel.width('20%');
19
customLabel.height('20%');
20
//disable legend
21
chart.legend(false);
22
23
//create empty area in pie chart
24
chart.innerRadius('50%');
25
26
//set container id for the chart
27
chart.container('container');
28
//initiate chart drawing
29
chart.draw();
30
});