Highchart library and responsive design - Javascript highcharts

Javascript examples for highcharts:Responsive Chart

Description

Highchart library and responsive design

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <style id="compiled-css" type="text/css">

#container {/*from w  w  w. j  a  va 2  s  .  c  o m*/
   height: 300px;
}


      </style> 
   </head> 
   <body> 
      <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container"></div> 
      <script type="text/javascript">
var chart = Highcharts.chart('container', {
  title: {
    text: 'Highcharts responsive chart'
  },
  series: [{
    data: [434, 523]
  }],
  responsive: {
    rules: [{
      condition: {
        maxWidth: 500
      },
      chartOptions: {
        title: {
          text: 'condition1'
        }
      }
    }, {
      condition: {
        maxWidth: 300
      },
      chartOptions: {
        title: {
          text: 'condition2'
        }
      }
    }]
  }
});

      </script>  
   </body>
</html>

Related Tutorials