Jquery Flot"plothover"事件不起作用

gab*_*m10 15 html javascript jquery jquery-plugins flot

我有一个问题似乎无法追查.我使用Flot来绘制一些数据,超级简单.我想添加你在这里看到的悬停效果:Flot Example

不幸的是,在任何情况下都不能让'plothover'事件发生.这是代码中的简短片段:

$.plot($chartArea, eventData, eventOptions);

$chartArea.bind("plothover", function (event, pos, item) {
    console.log('hovering!');
});
Run Code Online (Sandbox Code Playgroud)

您是否需要在options对象中设置以启用此行为?谢谢!

gab*_*m10 42

就像一个白痴,我忘了包括网格选项.检查对象:

eventOptions = {
   points: {
        show: true
    },
    lines: {
        show: true
    },
    grid: { hoverable: true, clickable: true },
    xaxis: {
        min:earliestMessage.timestamp,
        max:currentTime,
        mode:"time",
        ticks:10
    }
};
Run Code Online (Sandbox Code Playgroud)

注意网格参数.这就是缺少的东西.咄!

:)