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.selected({fill: 'red'});
6
chart.listen('chartDraw', function () {
7
8
// Get selected points.
9
var points = chart.getSelectedPoints();
10
11
var point = points[0];
12
return point.selected(false);
13
});
14
chart.title('Get an array of the selected points and modify the point');
15
chart.container('container');
16
chart.draw();
17
chart.select([0, 1]);
18
});
19
20
function getData() {
21
return [
22
{x: 'California', y: '2004', heat: 1704211},
23
{x: 'California', y: '2005', heat: 2782680},
24
{x: 'California', y: '2006', heat: 2992679},
25
{x: 'Illinois', y: '2004', heat: 727914},
26
{x: 'Illinois', y: '2005', heat: 1150659},
27
{x: 'Illinois', y: '2006', heat: 1134085},
28
{x: 'Massachusetts', y: '2004', heat: 238819},
29
{x: 'Massachusetts', y: '2005', heat: 157719},
30
{x: 'Massachusetts', y: '2006', heat: 887169},
31
{x: 'New York', y: '2004', heat: 1667969},
32
{x: 'New York', y: '2005', heat: 2763503},
33
{x: 'New York', y: '2006', heat: 3151022},
34
{x: 'Texas', y: '2004', heat: 219967},
35
{x: 'Texas', y: '2005', heat: 3732889},
36
{x: 'Texas', y: '2006', heat: 4185098}
37
]
38
}