Highcharts Stock Demo

author(s): Torstein Hønsi

by navindian

HTML

<div id="container" style="height: 400px; min-width: 600px"></div>

<button id="button">get extremes</button>

<script src="http://code.highcharts.com/stock/highstock.js"></script>
<script src="http://code.highcharts.com/stock/modules/exporting.js"></script>
<script type="text/javascript" src="http://www.highcharts.com/samples/data/usdeur.js"></script>

JavaScript

var called = false;
var chart = new Highcharts.StockChart({

    chart: {
        renderTo: 'container',
                                          zoomType: 'xy',

    },
    xAxis: {
        events: {
            setExtremes: function(ev) {
                if(this.oldMin === ev.min && this.oldMax === ev.max){
                    alert('Clicked All');
                   

                  }
                try {
                                //Run some code here

                                if ( typeof (ev.rangeSelectorButton) != "undefined") {
                                    alert('clicked button');
                                    if (ev.rangeSelectorButton.type == "all") {
                                        alert('clicked on all button to zoom back on xaxis and y axis');
                                      
                                            
      
          }

                                }
                            } catch(err) {
                                //Handle errors here
                            }

            }
        }
    },
    rangeSelector : {
          buttons : [{
            type : 'minute',
            count : 1,
            text : 'Min'
          }, {
            type : 'minute',
            count : 60,
            text : 'Hr'
          }, {
            type : 'day',
            count : 1,
            text : 'day'
          }, {
           type: 'all',
  text: 'All'
          }]
        }, 
    series: [{
        name: 'USD to EUR',
        data: usdeur}],
    xAxis: {
      
    }
});

// the button action
$('#button').click(function() {


});