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
// create data
4
var data = [
5
{x: "2010", y: "A", heat: 15},
6
{x: "2011", y: "A", heat: 17},
7
{x: "2012", y: "A", heat: 21},
8
{x: "2013", y: "A", heat: 23},
9
{x: "2010", y: "B", heat: 34},
10
{x: "2011", y: "B", heat: 33},
11
{x: "2012", y: "B", heat: 32},
12
{x: "2013", y: "B", heat: 30},
13
{x: "2010", y: "C", heat: 43},
14
{x: "2011", y: "C", heat: 42},
15
{x: "2012", y: "C", heat: 40},
16
{x: "2013", y: "C", heat: 38},
17
{x: "2010", y: "D", heat: 8},
18
{x: "2011", y: "D", heat: 8},
19
{x: "2012", y: "D", heat: 7},
20
{x: "2013", y: "D", heat: 8}
21
];
22
23
// create a chart and set the data
24
var chart = anychart.heatMap(data);
25
26
// configure the visual settings of the chart
27
chart.hovered().fill("gray", 0.4);
28
chart.selected().fill("gray", 0.6);
29
chart.selected().hatchFill("forward-diagonal", "gray", 2, 20);
30
chart.normal().stroke("gray");
31
chart.hovered().stroke("gray");
32
chart.selected().stroke("gray", 2);
33
34
// set the chart title
35
chart.title("Heat Map: Appearance");
36
37
// set the container id
38
chart.container("container");
39
40
// initiate drawing the chart
41
chart.draw();
42
});