File size: 2,632 Bytes
7b52e07
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<!doctype html>
<html lang="en">
 <head>
  <meta charset="UTF-8">
  <meta content="IE=edge" http-equiv="X-UA-Compatible">
  <meta content="width=device-width, initial-scale=1" name="viewport">
  <title>BCT Heat Map Chart 06</title>
  <link href="https://playground.anychart.com/docs/samples/BCT_Heat_Map_Chart_06/iframe" rel="canonical">
  <meta content="HeatMap Chart" name="keywords">
  <meta content="AnyChart - JavaScript Charts designed to be embedded and integrated" name="description">
  <!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
  <link href="_deps/cdn.anychart.com/releases/8.14.1/css/anychart-ui.min_qe95e7e741b.css" rel="stylesheet" type="text/css">
  <style>html, body, #container {
    width: 100%;
    height: 100%;
    margin: 0;
    padding: 0;
}</style>
 </head>
 <body>
  <div id="container"></div>
  <script src="_deps/cdn.anychart.com/releases/8.14.1/js/anychart-base.min_qe95e7e741b.js"></script>
  <script src="_deps/cdn.anychart.com/releases/8.14.1/js/anychart-heatmap.min_qe95e7e741b.js"></script>
  <script src="_deps/cdn.anychart.com/releases/8.14.1/js/anychart-exports.min_qe95e7e741b.js"></script>
  <script src="_deps/cdn.anychart.com/releases/8.14.1/js/anychart-ui.min_qe95e7e741b.js"></script>
  <script type="text/javascript">anychart.onDocumentReady(function () {

    // create data
    var data = [
      {x: "2010", y: "A", heat: 15},
      {x: "2011", y: "A", heat: 17},
      {x: "2012", y: "A", heat: 21},
      {x: "2013", y: "A", heat: 23},
      {x: "2010", y: "B", heat: 34},
      {x: "2011", y: "B", heat: 33},
      {x: "2012", y: "B", heat: 32},
      {x: "2013", y: "B", heat: 30},
      {x: "2010", y: "C", heat: 43},
      {x: "2011", y: "C", heat: 42},
      {x: "2012", y: "C", heat: 40},
      {x: "2013", y: "C", heat: 38},
      {x: "2010", y: "D", heat: 8},
      {x: "2011", y: "D", heat: 8},
      {x: "2012", y: "D", heat: 7},
      {x: "2013", y: "D", heat: 8}
    ];

    // create a chart and set the data
    var chart = anychart.heatMap(data);

    // create and configure a color scale.
    var customColorScale = anychart.scales.linearColor();
    customColorScale.colors(["#00ccff", "#ffcc00"]);

    // set the color scale as the color scale of the chart
    chart.colorScale(customColorScale);

    // set the chart title
    chart.title("Heat Map: Color Scale (Linear)");

    // set the container id
    chart.container("container");

    // initiate drawing the chart
    chart.draw();
});</script>
 </body>
</html>