rangeSelector button is selected - Javascript highcharts

Javascript examples for highcharts:Chart Range

Description

rangeSelector button is selected

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"> 
      <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 
      <script type="text/javascript">
$(function() {/*w  ww  . j  a  v a 2  s.  c o  m*/
   $('#container').highcharts('StockChart', {
       xAxis: {
          events: {
             setExtremes: function(e) {
                    console.log(this);
                    if(typeof(e.rangeSelectorButton)!== 'undefined')
                    {
                      console.log('count: '+e.rangeSelectorButton.count + 'text: ' +e.rangeSelectorButton.text + ' type:' + e.rangeSelectorButton.type);
                    }
             }
          }
       },
       rangeSelector: {
          selected: 1
       },
       series: [{
           name: 'USD to EUR',
           data: usdeur
       }]
   });
});

      </script> 
   </head> 
   <body> 
      <div id="container" style="height: 400px; min-width: 600px"></div> 
      <div id="report" style="font: 0.8em sans-serif"></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/usdeur.js"></script>  
   </body>
</html>

Related Tutorials