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.heatMap(data);
7
chart.title('Get and use pixel bounds object');
8
chart.container(stage);
9
chart.draw();
10
11
// Get pixel bounds.
12
var bounds = chart.getPixelBounds();
13
14
var customBackground = anychart.standalones.background();
15
customBackground.fill('#ff7f50 0.2');
16
customBackground.parentBounds(bounds);
17
customBackground.container(stage);
18
customBackground.draw();
19
});
20
21
function getData() {
22
return [
23
{x: 'California', y: '2004', heat: 1704211},
24
{x: 'California', y: '2005', heat: 2782680},
25
{x: 'California', y: '2006', heat: 2992679},
26
{x: 'Illinois', y: '2004', heat: 727914},
27
{x: 'Illinois', y: '2005', heat: 1150659},
28
{x: 'Illinois', y: '2006', heat: 1134085},
29
{x: 'Massachusetts', y: '2004', heat: 238819},
30
{x: 'Massachusetts', y: '2005', heat: 157719},
31
{x: 'Massachusetts', y: '2006', heat: 887169},
32
{x: 'New York', y: '2004', heat: 1667969},
33
{x: 'New York', y: '2005', heat: 2763503},
34
{x: 'New York', y: '2006', heat: 3151022},
35
{x: 'Texas', y: '2004', heat: 219967},
36
{x: 'Texas', y: '2005', heat: 3732889},
37
{x: 'Texas', y: '2006', heat: 4185098}
38
]
39
}