Heat map

author(s): Torstein Hønsi

by Black Label

HTML

<script src="https://code.highcharts.com/highcharts.js"></script>
<script src="https://code.highcharts.com/modules/heatmap.js"></script>
<div id="container"></div>

JavaScript

(function(H) {
  const merge = H.merge
  H.wrap(H.seriesTypes.heatmap.prototype, 'pointAttribs', function(point, state) {

  });
}(Highcharts));


Highcharts.chart('container', {

  chart: {
    type: 'heatmap',
    marginTop: 40,
    marginBottom: 80,
    plotBorderWidth: 1
  },

  colorAxis: {
    min: 0,
    minColor: '#FFFFFF',
    maxColor: Highcharts.getOptions().colors[0]
  },
  plotOptions: {
    series: {
      point: {
        events: {
          click: function(event) {
            event.point.graphic.attr({
              'stroke-width': 2,
              stroke: 'red'
            })
          },
        }
      }
    }
  },


  series: [{
    name: 'Sales per employee',
    borderWidth: 1,
    allowPointSelect: true,
    // borderColor: 'red',
    states: {
      hover: {
        enabled: false
      },
    },
    data: [
      [0, 0, 10],
      [0, 1, 19],
      [0, 2, 8],
      [0, 3, 24],
      [0, 4, 67],
      [1, 0, 92],
      [1, 1, 58],
      [1, 2, 78],
      [1, 3, 117],
      [1, 4, 48],
      [2, 0, 35],
      [2, 1, 15],
      [2, 2, 123],
      [2, 3, 64],
      [2, 4, 52],
      [3, 0, 72],
      [3, 1, 132],
      [3, 2, 114],
      [3, 3, 19],
      [3, 4, 16]
    ],
    dataLabels: {
      enabled: true,
      color: '#000000'
    }
  }]
});