hide the navigator at runtime? - Javascript highcharts

Javascript examples for highcharts:Chart Configuration

Description

hide the navigator at runtime?

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Hide Highstock Navigator - Method 2 (Better)</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
      <script type="text/javascript" src="https://code.jquery.com/jquery-1.9.1.js"></script> 
      <script type="text/javascript">
    $(window).load(function(){/*  ww  w  . j av a  2  s.c  o  m*/
$(function () {
    var delta = 0;
    $.getJSON('https://www.highcharts.com/samples/data/jsonp.php?filename=aapl-c.json&callback=?', function (data) {
        // Create the chart
        var chart = $('#container').highcharts('StockChart', {
            chart: {
                events: {
                    load: function () {
                        // this is always constant after the chart is loaded
                        delta = this.scroller.navigatorGroup.getBBox().height + 30;
                    }
                }
            },
            rangeSelector: {
                selected: 1
            },
            title: {
                text: 'AAPL Stock Price'
            },
            series: [{
                name: 'AAPL',
                data: data,
                tooltip: {
                    valueDecimals: 2
                }
            }]
        }, function (chart) {
            $('#show-hide-nav-btn').click(function () {
                var chartHeight = $('.highcharts-container').height();
                $('#container').height(chartHeight + delta);
                $('.highcharts-container').height(chartHeight + delta);
                chart.reflow();
                delta = -delta;
            });
        });
    });
});
    });

      </script> 
   </head> 
   <body> 
      <script src="https://code.highcharts.com/stock/highstock.js"></script> 
      <script src="https://code.highcharts.com/stock/modules/exporting.js"></script> 
      <button id="show-hide-nav-btn">Show / hide navigator</button> 
      <div id="clip" style="height: 500px; overflow: hidden;"> 
         <div id="container" style="height: 500px; min-width: 500px"></div> 
      </div>  
   </body>
</html>

Related Tutorials