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
3
// data
4
var data = anychart.data.set([
5
{x: "California", y: "2004", heat: 1704211},
6
{x: "California", y: "2005", heat: 2782680},
7
{x: "California", y: "2006", heat: 2992679},
8
{x: "Colorado", y: "2004", heat: 448302},
9
{x: "Colorado", y: "2005", heat: 768390},
10
{x: "Colorado", y: "2006", heat: 843584},
11
{x: "DC", y: "2004", heat: 693211},
12
{x: "DC", y: "2005", heat: 1215158},
13
{x: "DC", y: "2006", heat: 1053581},
14
{x: "Florida", y: "2004", heat: 405985},
15
{x: "Florida", y: "2005", heat: 661250},
16
{x: "Florida", y: "2006", heat: 811924},
17
{x: "Illinois", y: "2004", heat: 727914},
18
{x: "Illinois", y: "2005", heat: 1150659},
19
{x: "Illinois", y: "2006", heat: 1134085},
20
{x: "Texas", y: "2004", heat: 219967},
21
{x: "Texas", y: "2005", heat: 3732889},
22
{x: "Texas", y: "2006", heat: 4185098},
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
30
]);
31
32
// set chart type
33
var chart = anychart.heatMap(data);
34
chart.title("Sales Revenue");
35
36
chart.fill("#FFD54F");
37
chart.stroke("#FFF");
38
var labels = chart.labels();
39
labels.enabled(true);
40
labels.format("${%heat}");
41
42
var xLabels = chart.xAxis().labels();
43
xLabels.fontSize(10);
44
45
// draw chart
46
chart.container("container");
47
chart.draw();
48
});