How to call another function on changing the time range selector and date selector in Highcharts stock?

I am using stock Highcharts where I have a time range selector and date selector. I want to call another function on the change of time range selector and date selector. How can I do that?

Here’s the Highchart stock code:

    Highcharts.stockChart("config", {
  chart: {
    alignTicks: false
  },

  rangeSelector: {
    selected: 1
  },

  title: {
    text: "Summary"
  },

  series: series
});

};

Here’s the image: enter image description here

I have pointed the time range selector and From – To date selector in the above image

Answer

Depending on your needs use setExtremes or afterSetExtremes event callback function:

    xAxis: {
        events: {
            setExtremes: function(e) {
                ...
            },
            afterSetExtremes: function(e) {
                ...
            }
        }
    }

Live demo: http://jsfiddle.net/BlackLabel/j0acLf8v/

API Reference:

https://api.highcharts.com/highstock/xAxis.events.setExtremes

https://api.highcharts.com/highstock/xAxis.events.afterSetExtremes