当点击一个系列时,我收到下一个错误:Uncaught TypeError: Property 'firePointEvent' of object # is not a function。
在 Highstock.js v1.3.1 (2013-04-15) 第 9575 行中:
// the series click event
fireEvent(hoverPoint.series, 'click', extend(e, {
point: hoverPoint
}));
在此之前,hoverPoint
存在并具有实际值,但还没有 firePointEvent
方法。
// the point click event
hoverPoint.firePointEvent('click', e);
在下一行中,hoverPoint
仍然存在,并且确实有一个 firePointEvent
方法,但其所有属性均为 null。所以它抛出错误:/
这里有什么问题吗?
最佳答案
我可以重现这个问题。您可以在 this fiddle 中看到它。
- 点击图表背景(它会删除线条)
- 然后单击该系列(线路返回并触发错误)
我找到了解决此问题的方法,您必须设置一点超时,以便单击事件和更新过程不会在同一调用中发生。
我猜 update()
会更改 hoverPoint 对象,导致 firePointEvent 属性为 null
在进程结束时。
解决方法如下:( in JSFiddle here )
plotOptions: {
series: {
events: {
click: function(event) {
var that = this;
setTimeout( function(){
that.update({
lineWidth: 1,
});
}, 20);
}
}
}
},
关于javascript - 高库存 : Property 'firePointEvent' of object #<Object> is not a function,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16560340/