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.scatter();
5
chart.line([
6
{x: 1, value: 0},
7
{x: 2, value: 20},
8
{x: 3, value: 10},
9
{x: 4, value: 30},
10
{x: 5, value: 20},
11
{x: 6, value: 40},
12
{x: 7, value: 30},
13
{x: 8, value: 50},
14
{x: 9, value: 40},
15
{x: 1, value: 0}
16
]);
17
chart.xGrid(true).yGrid(true);
18
chart.title('Get and use pixel bounds object');
19
chart.container(stage);
20
chart.draw();
21
22
// Gets pixel bounds.
23
var bounds = chart.getPixelBounds();
24
25
var customBackground = anychart.standalones.background();
26
customBackground.fill('#ff7f50 0.2');
27
customBackground.parentBounds(bounds);
28
customBackground.container(stage);
29
customBackground.draw();
30
});