HTMLcopy
1
<button onclick="saveAsSvg();">Save image</button>
2
<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
var chart;
2
anychart.onDocumentReady(function () {
3
chart = anychart.wordtree(getData());
4
chart.title('Save chart as SVG file with paper size and landscape orientation set');
5
chart.container('container');
6
chart.draw();
7
});
8
9
function saveAsSvg() {
10
11
// Save chart as SVG file
12
chart.saveAsSvg('a5', true);
13
}
14
15
function getData() {
16
return [
17
'Earth is round',
18
'Earth is the third planet from the Sun',
19
'Earth goes around the Sun',
20
'Earth has one satellite',
21
'Earth has a radius of 6 371 km',
22
'Earth is less than the Sun',
23
'Earth is less than the Jupiter',
24
'Earth is less than the Saturn',
25
'Earth is less than the Uranus',
26
'Earth is less than the Neptune',
27
'Earth is bigger than the Venus',
28
'Earth is bigger than the Mars',
29
'Earth is bigger than the Mercury',
30
'Earth has a powerful magnetic field'
31
]
32
}