HTMLcopy
1
<div id="container"></div>
2
<div style="position: absolute; top: 10px; left: 45%; width: 50%;">
3
<input style="margin-bottom: 10px;" type="button" value="getSvgBase64String" onclick="getSvgBase64String()">
4
<textarea style="width: 100%;" rows="5" cols="70" id="getSvgBase64String"></textarea>
5
</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.margin('25%');
5
chart.title('Returns SVG as base64 string');
6
chart.container('container');
7
chart.draw();
8
});
9
10
function getSvgBase64String() {
11
12
// Get SVG as base64 string.
13
chart.getSvgBase64String(function (response) {
14
var base64String = document.getElementById('getSvgBase64String');
15
base64String.innerHTML = response;
16
});
17
}
18
19
function getData() {
20
return [
21
'Earth is round',
22
'Earth is the third planet from the Sun',
23
'Earth goes around the Sun',
24
'Earth has one satellite',
25
'Earth has a radius of 6 371 km',
26
'Earth is less than the Sun',
27
'Earth is less than the Jupiter',
28
'Earth is less than the Saturn',
29
'Earth is less than the Uranus',
30
'Earth is less than the Neptune',
31
'Earth is bigger than the Venus',
32
'Earth is bigger than the Mars',
33
'Earth is bigger than the Mercury',
34
'Earth has a powerful magnetic field'
35
]
36
}