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
var rawData = [
3
{
4
value: 'Earth',
5
children: [{
6
value: 'is',
7
children: [
8
{value: 'round'},
9
{value: 'the third planet from the Sun'},
10
{
11
value: 'less than the', children: [
12
{value: 'Sun'},
13
{value: 'Jupiter'},
14
{value: 'Saturn'},
15
{value: 'Uranus'},
16
{value: 'Neptune'},
17
]
18
},
19
20
{
21
value: 'bigger than the', children: [
22
{value: 'Venus'},
23
{value: 'Mars'},
24
{value: 'Mercury'}
25
]
26
}
27
]
28
},
29
{value: 'goes around the Sun'},
30
{
31
value: 'has',
32
children: [
33
{value: 'one satellite'},
34
{
35
value: 'a', children: [
36
{value: 'radius of 6 371 km'},
37
{value: 'powerful magnetic field'}
38
]
39
}
40
]
41
}]
42
}];
43
44
45
var chart = anychart.wordtree();
46
47
var treeData = anychart.data.tree(rawData, 'as-tree');
48
49
// Set chart data.
50
chart.data(treeData);
51
52
chart.title('Set chart data parameter as a data tree');
53
chart.container('container');
54
chart.draw();
55
});