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
chart = anychart.line([
5
{x: 'January', value: 2},
6
{x: 'February', value: 5},
7
{x: 'March', value: 3},
8
{x: 'April', value: 9},
9
{x: 'May', value: 4}
10
]);
11
12
var yAxis = chart.yAxis();
13
14
chart.title('Get and use pixel bounds object');
15
chart.container(stage);
16
chart.draw();
17
18
// Get pixel bounds.
19
var bounds = yAxis.getPixelBounds();
20
21
var customBackground = anychart.standalones.background();
22
customBackground.fill('#81D4FA 0.2');
23
customBackground.parentBounds(bounds);
24
customBackground.container(stage);
25
customBackground.draw();
26
});