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
6
// Set annotations settings.
7
chart.annotations([{
8
type: 'line',
9
xAnchor: 'California',
10
valueAnchor: '2004',
11
secondXAnchor: 'Massachusetts',
12
secondValueAnchor: '2004',
13
stroke: '3 #FF9800'
14
}, {
15
type: 'line',
16
xAnchor: 'Massachusetts',
17
valueAnchor: '2004',
18
secondXAnchor: 'Massachusetts',
19
secondValueAnchor: '2006',
20
stroke: '3 #FF9800'
21
}
22
]);
23
24
chart.title('Set annotations settings');
25
chart.container('container');
26
chart.draw();
27
});
28
29
function getData() {
30
return [
31
{x: 'California', y: '2004', heat: 1704211},
32
{x: 'California', y: '2005', heat: 2782680},
33
{x: 'California', y: '2006', heat: 2992679},
34
{x: 'Illinois', y: '2004', heat: 727914},
35
{x: 'Illinois', y: '2005', heat: 1150659},
36
{x: 'Illinois', y: '2006', heat: 1134085},
37
{x: 'Massachusetts', y: '2004', heat: 238819},
38
{x: 'Massachusetts', y: '2005', heat: 157719},
39
{x: 'Massachusetts', y: '2006', heat: 887169},
40
{x: 'New York', y: '2004', heat: 1667969},
41
{x: 'New York', y: '2005', heat: 2763503},
42
{x: 'New York', y: '2006', heat: 3151022},
43
{x: 'Texas', y: '2004', heat: 219967},
44
{x: 'Texas', y: '2005', heat: 3732889},
45
{x: 'Texas', y: '2006', heat: 4185098}
46
]
47
}