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 data
4
var data = [
5
{x: "A", value: 110},
6
{x: "B", value: 90},
7
{x: "C", value: 120},
8
{x: "D", value: 125},
9
{x: "E", value: 95}
10
];
11
12
// create a pie chart and set the data
13
var chart = anychart.pie(data);
14
15
/* set the inner radius
16
(to turn the pie chart into a doughnut chart)*/
17
chart.innerRadius("75%");
18
19
// set the position of labels
20
var labels = chart.labels();
21
labels.position("inside");
22
23
// configure the labels: font, overlap, offset
24
labels.fontColor("#000000");
25
chart.overlapMode(true);
26
chart.insideLabelsOffset("-75%");
27
28
// disable the legend
29
chart.legend(false);
30
31
// set the chart title
32
chart.title("Doughnut Chart: Inner Labels");
33
34
// set the container id
35
chart.container("container");
36
37
// initiate drawing the chart
38
chart.draw();
39
});