multiple heatmaps with shared color bar chart - Javascript highcharts

Javascript examples for highcharts:Heatmap Chart

Description

multiple heatmaps with shared color bar chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts test tool</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-git.js"></script> 
      <style id="compiled-css" type="text/css">

#container {/*from w w w  . j a v a  2s . c  om*/
   min-width: 300px;
   max-width: 800px;
   height: 400px;
   margin: 1em auto;
}


      </style> 
      <script type="text/javascript">
    $(function(){
$(function() {
  $('#container').highcharts({
    chart: {
      type: 'heatmap'
    },
    title: null,
    plotOptions: {
        series: {
            borderColor: 'white'
        }
    },
    colorAxis: {
      min: 0,
      max: 1,
      minColor: 'white',
      maxColor: Highcharts.getOptions().colors[5]
    },
    legend: {
      enabled: false
    },
    xAxis: {
       visible: false
    },
    yAxis: {
       visible: false
    },
    series: [{
      name: 'Sales per employee',
      borderWidth: 1,
      data: [...Array(43*43)].map((u, i) => {
         const x = Math.floor(i/43)
            const y = i%43
        const zeroX = !((x+1) % 9) || !((x+2) % 9)
        const zeroY = !((y+1) % 9) || !((y+2) % 9)
        const v = zeroX || zeroY ? 0 : Math.random()
         return [x, y, v]
      })
    }]
  });
});
    });

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

Related Tutorials