本文介绍了Highcharts中的捕捉平移事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
用户平移图表时是否可以捕获事件?
Is it possible to catch event when user is panning on chart?
我已将Highcharts选项设置为:
I've Highcharts options set to:
chart: {
panning: true,
panKey: 'shift',
events: {}
}
在事件对象中,选择有效.在文档中,没有关于窗格事件的任何信息.
In events object, selection is working. In the documentation, there's nothing about pane event.
是否有办法赶上此事件?
Is there a way to catch this event anyway?
推荐答案
默认情况下,Highcharts不提供此类事件.
Highcharts doesn't provide that kind of event by default.
此问题的解决方法是包装核心pan
函数:
The workaround for this is to wrap the core pan
function:
(function(H) {
H.wrap(H.Chart.prototype, 'pan', function(proceed) {
console.log("panning...");
proceed.call(this, arguments[1], arguments[2]);
});
})(Highcharts);
实时演示: http://jsfiddle.net/kkulig/gn8gmsn0/
文档参考: https://www .highcharts.com/docs/extending-highcharts/extending-highcharts
这篇关于Highcharts中的捕捉平移事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!