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 data = getData();
3
4
var chart = anychart.heatMap(data);
5
chart.title('Click on the chart and then double-click');
6
chart.listen('click', function (e) {
7
chart.title({fontColor: '#4CAF50'});
8
});
9
10
chart.listen('dblClick', function (e) {
11
chart.title('You can\'t click here anymore');
12
chart.title({fontColor: '#000000'});
13
14
// Removes all listeners
15
chart.removeAllListeners();
16
17
});
18
19
chart.container('container');
20
chart.draw();
21
});
22
23
function getData() {
24
return [
25
{x: 'California', y: '2004', heat: 1704211},
26
{x: 'California', y: '2005', heat: 2782680},
27
{x: 'California', y: '2006', heat: 2992679},
28
{x: 'Illinois', y: '2004', heat: 727914},
29
{x: 'Illinois', y: '2005', heat: 1150659},
30
{x: 'Illinois', y: '2006', heat: 1134085},
31
{x: 'Massachusetts', y: '2004', heat: 238819},
32
{x: 'Massachusetts', y: '2005', heat: 157719},
33
{x: 'Massachusetts', y: '2006', heat: 887169},
34
{x: 'New York', y: '2004', heat: 1667969},
35
{x: 'New York', y: '2005', heat: 2763503},
36
{x: 'New York', y: '2006', heat: 3151022},
37
{x: 'Texas', y: '2004', heat: 219967},
38
{x: 'Texas', y: '2005', heat: 3732889},
39
{x: 'Texas', y: '2006', heat: 4185098}
40
]
41
}