Jquery Flot“plothover”事件不起作用 [英] Jquery Flot "plothover" event not working
本文介绍了Jquery Flot“plothover”事件不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个我似乎无法追查的问题。我使用Flot来绘制一些数据,非常简单。我想添加您在这里看到的悬停效果: Flot示例
不幸的是,在任何情况下我都不能让'plothover'事件发生。这是代码中的简短代码片段:
$。plot($ chartArea,eventData,eventOptions);
$ b $ chartArea.bind(plothover,function(event,pos,item){
console.log('hovering!');
});
您是否需要在选项对象中设置以启用此行为?谢谢!
解决方案
像一个白痴,我忘了包含网格选项。查看对象:
eventOptions = {
points:{
show:true
},
lines:{
show:true
},
grid:{hoverable:true,clickable:true},
xaxis:{
min :earliestMessage.timestamp,
max:currentTime,
mode:time,
ticks:10
}
};
请注意网格参数。这就是缺少的。 Duh!
:)
I have an issue I can't seem to track down. I am using Flot to graph some data, super easy. I want to add the hover effect you see here: Flot Example
Unfortunately, under no circumstance can I get the 'plothover' event to fire. This is a brief snippet from the code:
$.plot($chartArea, eventData, eventOptions);
$chartArea.bind("plothover", function (event, pos, item) {
console.log('hovering!');
});
Is there something you need to set in the options object to enable this behavior? Thanks!
解决方案
Like an idiot, I forgot to include the grid option. Check out the object:
eventOptions = {
points: {
show: true
},
lines: {
show: true
},
grid: { hoverable: true, clickable: true },
xaxis: {
min:earliestMessage.timestamp,
max:currentTime,
mode:"time",
ticks:10
}
};
notice the grid parameter. That's what was missing. Duh!
:)
这篇关于Jquery Flot“plothover”事件不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文