reflow with class selector in line chart - Javascript highcharts

Javascript examples for highcharts:Line Chart

Description

reflow with class selector in line chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function () {//from w w w  . ja  va 2s .  co m
    $('#container1').highcharts({
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar']
        },
        series: [{
            data: [29.9, 71.5, 106.4]
        }]
    });
    $('#container2').highcharts({
        xAxis: {
            categories: ['Jan', 'Feb', 'Mar']
        },
        series: [{
            data: [29.9, 71.5, 106.4]
        }]
    });
    var wide = false;
    $('#set-div-size').click(function () {
        $('#container1').width(wide ? 400 : 500);
        $('#container2').width(wide ? 400 : 500);
        wide = !wide;
    });
    $('#reflow-chart-byid').click(function () {
        $('#container1').highcharts().reflow();
        $('#container2').highcharts().reflow();
    });
    $('#reflow-chart-byclass').click(function () {
        $('.needreflow').each(function() { $(this).highcharts().reflow(); });
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.src.js"></script> 
      <script src="https://code.highcharts.com/modules/exporting.js"></script> 
      <div style="width: 600px"> 
         <div id="container1" class="needreflow" style="width: 400px; height: 300px; margin: 1em; border: 1px solid gray"></div> 
         <div id="container2" class="needreflow" style="width: 400px; height: 300px; margin: 1em; border: 1px solid gray"></div> 
      </div> 
      <button id="set-div-size" class="autocompare">Toggle container size</button> 
      <button id="reflow-chart-byid" class="autocompare">Reflow charts by id selector</button> 
      <button id="reflow-chart-byclass" class="autocompare">Reflow charts by class selector</button>  
   </body>
</html>

Related Tutorials