简体   繁体   English

如何在更改 Highcharts 股票中的时间范围选择器和日期选择器时调用另一个 function?

[英]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.我正在使用股票 Highcharts ,其中我有一个时间范围选择器和日期选择器。 I want to call another function on the change of time range selector and date selector.我想在时间范围选择器和日期选择器的更改上调用另一个 function。 How can I do that?我怎样才能做到这一点?

Here's the Highchart stock code:这是 Highchart 的股票代码:

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

  rangeSelector: {
    selected: 1
  },

  title: {
    text: "Summary"
  },

  series: series
});

}; };

Here's the image:这是图像: 在此处输入图像描述

I have pointed the time range selector and From - To date selector in the above image我在上图中指出了时间范围选择器和从 - 到日期选择器

Depending on your needs use setExtremes or afterSetExtremes event callback function:根据您的需要使用setExtremesafterSetExtremes事件回调 function:

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

Live demo: http://jsfiddle.net/BlackLabel/j0acLf8v/现场演示: http://jsfiddle.net/BlackLabel/j0acLf8v/

API Reference: API 参考资料:

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

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM