Heatmap chart with JSON data - Javascript highcharts

Javascript examples for highcharts:Chart Json Data

Description

Heatmap chart with JSON data

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.8.3.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*from w  w w .  j  a v a 2  s .c  o m*/
    $('#container').highcharts({
        chart: {
            type: 'heatmap'
        },
        title: {
            text: null
        },
        tooltip: {
            formatter: function () {
                return '<b>' + this.series.yAxis.categories[this.point.y] + ' </b> had a value of <br><b>' + this.point.value + '</b> on <b>' + this.series.xAxis.categories[this.point.x] + '</b>';
            },
            borderWidth: 1,
            borderColor: '#000000',
            distance: 10,
            shadow: false,
            useHTML: true,
            style: {
                padding: 0,
                color: 'black'
            }
        },
        xAxis: {
            categories: ['2013-04-01', '2013-04-02', '2013-04-03'],
            labels: {
                rotation: 90
            }
        },
        yAxis: {
            title: {
                text: null
            },
            labels: {
                enabled: false
            },
            categories: ['Midnight', '1 am', '2 am', '3 am', '4 am', '5 am', '6 am', '7 am', '8 am', '9 am', '10 am', '11 am', 'Noon', '1 pm', '2 pm', '3 pm', '4 pm', '5 pm', '6 pm', '7 pm', '8 pm', '9 pm', '10 pm', '11 pm'],
            min: 0,
            max: 23,
            reversed: true
        },
        colorAxis: {
            stops: [
                [0, '#c4463a'],
                [0.1, '#c4463a'],
                [0.5, '#ffffff'],
                [1, '#3060cf']
            ],
            min: -50,
            max: 5,
            startOnTick: false,
            endOnTick: false
        },
        series: [{
            borderWidth: 0,
            nullColor: '#EFEFEF',
            data: [ [0,0,-0.7], [1,0,-3.4], [2,0,-1.1] ]
        }]
    });
    });

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <script src="https://code.highcharts.com/modules/heatmap.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div id="container" style="width:100%; height: 100%; margin: 0 auto"></div>  
   </body>
</html>

Related Tutorials