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 data = getData();
5
6
var chart = anychart.tagCloud(data);
7
8
chart.title('Get and use pixel bounds object');
9
chart.container(stage);
10
chart.draw();
11
12
// Get pixel bounds.
13
var bounds = chart.getPixelBounds();
14
15
var customBackground = anychart.standalones.background();
16
customBackground.fill('#ff7f50 0.2');
17
customBackground.parentBounds(bounds);
18
customBackground.container(stage);
19
customBackground.draw();
20
});
21
22
function getData() {
23
return [
24
{x: 'learning', value: 80},
25
{x: 'lists', value: 44},
26
{x: 'meaning', value: 40},
27
{x: 'useful', value: 36},
28
{x: 'different', value: 32},
29
{x: 'grammar', value: 28},
30
{x: 'teaching', value: 24},
31
{x: 'example', value: 20},
32
{x: 'includes', value: 56},
33
{x: 'thing', value: 12},
34
{x: 'vocabulary', value: 10},
35
{x: 'frequency', value: 10},
36
{x: 'phrases', value: 15},
37
{x: 'content', value: 27}
38
]
39
}