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 stage = anychart.graphics.create('container');
3
4
var chart = anychart.wordtree(getData());
5
chart.bounds(0, 0, '50%', '100%');
6
chart.title('Serialize chart string to JSON');
7
chart.container(stage);
8
chart.draw();
9
10
// Returns chart config as JSON string.
11
var json = chart.toJson(true);
12
13
var chartFromJson = anychart.fromJson(json);
14
chartFromJson.bounds('50%', 0, '50%', '100%');
15
chartFromJson.title('Creates chart from JSON string');
16
chartFromJson.container(stage);
17
chartFromJson.draw();
18
});
19
20
function getData() {
21
return [
22
'Earth is round',
23
'Earth is the third planet from the Sun',
24
'Earth goes around the Sun',
25
'Earth has one satellite',
26
'Earth has a radius of 6 371 km',
27
'Earth is less than the Sun',
28
'Earth is less than the Jupiter',
29
'Earth is less than the Saturn',
30
'Earth is less than the Uranus',
31
'Earth is less than the Neptune',
32
'Earth is bigger than the Venus',
33
'Earth is bigger than the Mars',
34
'Earth is bigger than the Mercury',
35
'Earth has a powerful magnetic field'
36
]
37
}