HTMLcopy
1
<button onclick="enableBackground()">Enable background</button>
2
<button onclick="disableBackground();">Disable background</button>
3
<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
var chart;
2
3
function disableBackground() {
4
5
// Disable background.
6
chart.background(false);
7
}
8
9
function enableBackground() {
10
11
// Enable background.
12
chart.background(true);
13
}
14
15
anychart.onDocumentReady(function () {
16
chart = anychart.heatMap([
17
{x: 'California', y: '2004', heat: 1704211},
18
{x: 'California', y: '2005', heat: 2782680},
19
{x: 'California', y: '2006', heat: 2992679},
20
{x: 'Illinois', y: '2004', heat: 727914},
21
{x: 'Illinois', y: '2005', heat: 1150659},
22
{x: 'Illinois', y: '2006', heat: 1134085},
23
{x: 'Massachusetts', y: '2004', heat: 238819},
24
{x: 'Massachusetts', y: '2005', heat: 157719},
25
{x: 'Massachusetts', y: '2006', heat: 887169},
26
{x: 'New York', y: '2004', heat: 1667969},
27
{x: 'New York', y: '2005', heat: 2763503},
28
{x: 'New York', y: '2006', heat: 3151022},
29
{x: 'Texas', y: '2004', heat: 219967},
30
{x: 'Texas', y: '2005', heat: 3732889},
31
{x: 'Texas', y: '2006', heat: 4185098}
32
]);
33
chart.background('#FFF59D');
34
chart.title('Enable/Disable chart background');
35
chart.container('container');
36
chart.draw();
37
});