set data for navigation in highstock chart - Javascript highcharts

Javascript examples for highcharts:Stock Chart

Description

set data for navigation in highstock chart

Demo Code

ResultView the demo in separate window

<html>
   <head> 
      <title>Highcharts Stock Demo</title> 
      <meta name="viewport" content="width=device-width, initial-scale=1"> 
   </head> 
   <body> 
      <div id="container" style="height: 400px; min-width: 600px"></div> 
      <script src="https://code.highcharts.com/stock/highstock.js"></script> 
      <script src="https://code.highcharts.com/stock/modules/exporting.js"></script> 
      <script type="text/javascript" src="https://www.highcharts.com/samples/data/three-series-1000-points.js"></script> 
      <button id="btn"> add sereis to navigator </button> 
      <script type="text/javascript">
var chart = Highcharts.stockChart('container', {
    rangeSelector: {/*from  w  w w.jav a 2  s. com*/
        selected: 1
    },
    series: [{
        name: 'MSFT',
        data: [1,2,3,4],
        showInNavigator: false
    }]
});
document.getElementById('btn').onclick = function () {
  chart.addSeries({
    data: [4,3,2,1],
    showInNavigator: true,
    visible: false
  });
}

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

Related Tutorials