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
{name: "Company A", children: [
6
{name: "Technical", children: [
7
{name: "Team Leaders"},
8
{name: "Architects"},
9
{name: "Developers"},
10
{name: "Testers"}
11
]},
12
{name: "Sales", children: [
13
{name: "Analysts"},
14
{name: "Executives"}
15
]},
16
{name: "HR"},
17
{name: "Management"}
18
]}
19
];
20
21
// create a chart and set the data
22
var chart = anychart.sunburst(data, "as-tree");
23
24
// set the inner radius
25
chart.innerRadius(50);
26
27
// create and configure a label
28
var label = anychart.standalones.label();
29
label.text("Corporate Structure");
30
label.width("100%");
31
label.height("100%");
32
label.fontColor("#dd2c00");
33
label.fontSize(12);
34
label.fontWeight(600);
35
label.hAlign("center");
36
label.vAlign("middle");
37
38
// set the center content
39
chart.center().content(label);
40
41
// set the chart title
42
chart.title("Sunburst: Center Content");
43
44
// set the container id
45
chart.container("container");
46
47
// initiate drawing the chart
48
chart.draw();
49
});