我有一个似乎无法查明的问题。我正在使用 Flot 绘制一些数据, super 简单。我想添加您在此处看到的悬停效果:Flot Example
不幸的是,在任何情况下我都无法触发“plotover”事件。这是代码的一个简短片段:
$.plot($chartArea, eventData, eventOptions);
$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
}
};
注意网格参数。那就是缺少的东西。呸!
:)
关于javascript - Jquery Flot "plothover"事件不工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10181837/