disable zoom while chart is loading - Javascript highcharts

Javascript examples for highcharts:Zoom

Description

disable zoom while chart is loading

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  .jav  a  2 s  . c om*/
    $('#container').highcharts({
        chart: {
            zoomType: ''
        },
        xAxis: {
            minRange: 1
        },
        series: [{
            data: [1,2,3,4,5,6,7]
        }]
    });
    function enableZoom(zoomType) {
        var chart = $('#container').highcharts(),
            zoomX = /x/.test(zoomType),
            zoomY = /y/.test(zoomType);
            chart.options.zoomType = zoomType;
            chart.pointer.zoomX = zoomX;
            chart.pointer.zoomY = zoomY;
            chart.pointer.zoomHor = zoomX;
            chart.pointer.zoomVert = zoomY;
    }
    $('#zoomX').click(function () {
        enableZoom('x');
    });
    $('#zoomY').click(function () {
        enableZoom('y');
    });
    $('#zoomXY').click(function () {
        enableZoom('xy');
    });
    $('#noZoom').click(function () {
        enableZoom('');
    });
});

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/highcharts.js"></script> 
      <div id="container" style="height: 400px"></div> 
      <button id="zoomX">zoom x</button> 
      <button id="zoomY">zoom y</button> 
      <button id="zoomXY">zoom xy</button> 
      <button id="noZoom">disable zoom</button>  
   </body>
</html>

Related Tutorials