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.sparkline([1.3, 2, 1.4, 4, 2.3, 6]);
5
6
chart.title({text: 'Get and use pixel bounds object', orientation: 'top'});
7
chart.container(stage);
8
chart.draw();
9
10
// Gets pixel bounds.
11
var bounds = chart.getPixelBounds();
12
13
var customBackground = anychart.standalones.background();
14
customBackground.fill('#ff7f50 0.2');
15
customBackground.parentBounds(bounds);
16
customBackground.container(stage);
17
customBackground.draw();
18
});