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 data = getData();
3
4
var chart = anychart.tagCloud(data);
5
chart.title('Get chart as SVG with predefined width and height');
6
chart.container('container');
7
chart.draw();
8
9
// Get chart as SVG with parameters
10
var SVGstring = chart.toSvg(300, 400);
11
// Now you can do something with this string, send it to the server and etc
12
});
13
function getData() {
14
return [
15
{x: 'learning', value: 80},
16
{x: 'lists', value: 44},
17
{x: 'meaning', value: 40},
18
{x: 'useful', value: 36},
19
{x: 'different', value: 32},
20
{x: 'grammar', value: 28},
21
{x: 'teaching', value: 24},
22
{x: 'example', value: 20},
23
{x: 'includes', value: 56},
24
{x: 'thing', value: 12},
25
{x: 'vocabulary', value: 10},
26
{x: 'frequency', value: 10},
27
{x: 'phrases', value: 15},
28
{x: 'content', value: 27}
29
]
30
}