HTMLcopy
1
<label><input onclick="interactivitySelectionMode('drill-down')" type="radio" name="mode">drill-down</label>
2
<label><input onclick="interactivitySelectionMode('multi-select')" type="radio" name="mode">multi-select</label>
3
<label><input onclick="interactivitySelectionMode('single-select')" type="radio" name="mode">single-select</label>
4
<label><input onclick="interactivitySelectionMode('none')" type="radio" name="mode" checked>none</label>
5
<div id="container"></div>
CSScopy
16
1
html, body {
2
width: 100%;
3
height: 100%;
4
margin: 0;
5
padding: 0;
6
}
7
label {
8
display: inline-block;
9
margin: 10px 0 0 10px;
10
}
11
#container {
12
position: absolute;
13
width: 100%;
14
top: 35px;
15
bottom: 0;
16
}
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
chart = anychart.sunburst(data, "as-tree");
23
24
// set the selection mode
25
chart.interactivity().selectionMode("none");
26
27
// set the chart title
28
chart.title().useHtml(true);
29
chart.title("Sunburst: Selection Mode = " +
30
chart.interactivity().selectionMode() + "<br><br>" +
31
"<span style='font-size:12; font-style:italic'>" +
32
"Company Structure");
33
34
35
// set the container id
36
chart.container("container");
37
38
// initiate drawing the chart
39
chart.draw();
40
});
41
42
// set the selection mode
43
function interactivitySelectionMode(mode) {
44
chart.interactivity().selectionMode(mode);
45
// update the chart title
46
chart.title("Sunburst: Selection Mode = " +
47
chart.interactivity().selectionMode() + "<br><br>" +
48
"<span style='font-size:12; font-style:italic'>" +
49
"Company Structure");
50
}