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
// configure the visual settings of the chart
25
chart.hovered().fill("#96a6a6", 0.4);
26
chart.selected().fill("#96a6a6", 0.6);
27
chart.selected().hatchFill("forward-diagonal", "#96a6a6", 0.5, 12);
28
chart.normal().stroke("#96a6a6", 2);
29
chart.hovered().stroke("#96a6a6", 2);
30
chart.selected().stroke("#96a6a6", 4);
31
32
// set the chart title
33
chart.title().useHtml(true);
34
chart.title("Sunburst: Appearance<br><br>" +
35
"<span style='font-size:12; font-style:italic'>" +
36
"Corporate Structure</span>");
37
38
// set the container id
39
chart.container("container");
40
41
// initiate drawing the chart
42
chart.draw();
43
});