0

When you programmatically call setExtremes on a Highcharts axis, it fires the setExtremes and afterSetExtremes events for that axis. Similarly, those two events are also fired when the user clicks and drags on the chart to zoom in.

Is there an easy way to differentiate between those two actions? Specifically, I have a date range selector that, when changed, should call setExtremes on the chart. I also want the range selector to update when the chart is zoomed by dragging. But if both actions fire the same events I have a loop. I could put some logic in to prevent that, but it would be much more elegant if I could use differents events for the two separate actions or suppress the events when I'm programmatically calling setExtremes.

4

1 回答 1

0

从源代码来看,看起来 afterSetExtremes 仅在极端值实际更改时才会触发,因此确实可以防止循环。

此外,setExtremes 函数中还有第 5 个参数(API 中没有记录,但在源代码中称为 eventArguments),可以用来表示哪个进程调用了 setExtremes 函数。

于 2013-06-14T18:14:53.523 回答