HTMLcopy
1
<div id="container"></div>
CSScopy
8
1
html,
2
body,
3
#container {
4
width: 100%;
5
height: 100%;
6
margin: 0;
7
padding: 0;
8
}
JavaScriptcopy
x
1
anychart.onDocumentReady(function () {
2
var data = getData();
3
4
var chart = anychart.sunburst(data, 'as-table');
5
6
// Get interactivity.
7
var interactivity = chart.interactivity();
8
interactivity.selectionMode("single-select");
9
10
chart.title('Chart selection mode "single-select"');
11
chart.container('container');
12
chart.draw();
13
});
14
15
function getData() {
16
return [{
17
name: 'Seasonal activities',
18
id: 'activities',
19
parent: null,
20
value: 1000
21
},
22
{
23
name: 'Winter',
24
parent: 'activities',
25
id: 'winter',
26
value: 250
27
},
28
{
29
name: 'Spring',
30
parent: 'activities',
31
id: 'spring',
32
value: 250
33
},
34
{
35
name: 'Summer',
36
parent: 'activities',
37
id: 'summer',
38
value: 250
39
},
40
{
41
name: 'Autumn',
42
parent: 'activities',
43
id: 'autumn',
44
value: 250
45
},
46
{
47
name: 'Running',
48
parent: 'winter',
49
id: 'run',
50
value: 43
51
},
52
{
53
name: 'Snowboarding',
54
parent: 'winter',
55
id: 'snowboard',
56
value: 50
57
},
58
{
59
name: 'Nordic Skiing',
60
parent: 'winter',
61
id: 'nordic',
62
value: 50
63
},
64
{
65
name: 'Working Out',
66
parent: 'winter',
67
id: 'workout',
68
value: 30
69
},
70
{
71
name: 'Ice Skating',
72
parent: 'winter',
73
id: 'iceskate',
74
value: 40
75
},
76
{
77
name: 'Kitesurfing',
78
parent: 'winter',
79
id: 'kitesurf',
80
value: 37
81
},
82
{
83
name: 'Riding',
84
parent: 'spring',
85
id: 'ride',
86
value: 100
87
},
88
{
89
name: 'Crossfit',
90
parent: 'spring',
91
id: 'crossfit',
92
value: 30
93
},
94
{
95
name: 'Hiking',
96
parent: 'spring',
97
id: 'hike',
98
value: 30
99
},
100
{
101
name: 'Yoga',
102
parent: 'spring',
103
id: 'yoga',
104
value: 40
105
},
106
{
107
name: 'Running',
108
parent: 'spring',
109
id: 'run',
110
value: 50
111
},
112
{
113
name: 'Riding',
114
parent: 'summer',
115
id: 'ride',
116
value: 150
117
},
118
{
119
name: 'Windsurfing',
120
parent: 'summer',
121
id: 'windsurf',
122
value: 20
123
},
124
{
125
name: 'Swimming',
126
parent: 'summer',
127
id: 'swim',
128
value: 30
129
},
130
{
131
name: 'Roller Skiing',
132
parent: 'summer',
133
id: 'roller',
134
value: 10
135
},
136
{
137
name: 'Rowing',
138
parent: 'summer',
139
id: 'rowing',
140
value: 40
141
},
142
{
143
name: 'Riding',
144
parent: 'autumn',
145
id: 'ride',
146
value: 90
147
},
148
{
149
name: 'Hiking',
150
parent: 'autumn',
151
id: 'windsurf',
152
value: 20
153
},
154
{
155
name: 'Swimming',
156
parent: 'autumn',
157
id: 'swim',
158
value: 10
159
},
160
{
161
name: 'Nordic Skiing',
162
parent: 'autumn',
163
id: 'nordic',
164
value: 40
165
},
166
{
167
name: 'Climbing',
168
parent: 'autumn',
169
id: 'climbing',
170
value: 40
171
}
172
];
173
}