Responsive charts - Javascript highcharts

Javascript examples for highcharts:Responsive Chart

Description

Responsive charts

Demo Code

ResultView the demo in separate window

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

html, body {
   height:100%;
}
#box {/*  w  ww  .j  a  v a 2s  .co  m*/
   height:80%;
   background:#331266;
}
#container {
   position:relative;
   height:100%;
}


      </style> 
      <script type="text/javascript">
var chart1;
$(function() {
      var newh = $("#box").height();
            $( window ).resize(function() {
          newh = $("#box").height();
        chart1.redraw();
        chart1.reflow();
});
      chart1 = new Highcharts.Chart({
         chart: {
            renderTo: 'container'
         },
              xAxis: {
        categories: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
            'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec']
    },
    series: [{
        data: [29.9, 71.5, 106.4, 129.2, 144.0, 176.0, 135.6, 148.5, 216.4, 194.1, 95.6, 54.4]
    }]
      });
   });

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

Related Tutorials