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

Hello Developer, Hope you guys are doing great. Today at Tutorial Guruji Official website, we are sharing the answer of How to call another function on changing the time range selector and date selector in Highcharts stock? without wasting too much if your time.

The question is published on by Tutorial Guruji team.

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

We are here to answer your question about How to call another function on changing the time range selector and date selector in Highcharts stock? - If you find the proper solution, please don't forgot to share this with your team members.

Related Posts

Tutorial Guruji