flot悬停,而不是点击事件

问题描述:

我现在面临一个问题:我得到了flot图表,当它被点击时,它显示一个带有数据的模块窗口。flot悬停,而不是点击事件

我需要做同样的事情,但不是点击事件,我需要在悬停时执行此操作。 github上的文档仅显示如何在点击事件中执行此操作。我徘徊在做悬停同样的事情。有人能帮我吗?

+0

给我们展示一些代码 – 2013-02-21 12:04:03

与悬停

$(function(){ 
    $("#yourID").hover(function(){ 
    //your code goes here 
    }) 
}) 
+1

它应该是'function()' – 2013-02-21 12:04:47

绑定两个处理程序更改功能事件匹配的元素,当鼠标指针进入和离开元件被执行。

$(function(){ 
    $("#yourID").hover(OnmouseoverFunction, Onmouseoutfunction); 
}) 

function OnmouseoverFunction() 
{ 
//on mouse over code 
} 

function Onmouseoutfunction() 
{ 
//on mouse outcode 
} 

用于在海军报悬停事件被称为“plothover”,使事件绑定到该图的容器和设置回调,像这样:

$(diagramContainer).bind("plothover",function(event, pos, item) { 
    // event holds the js event, pos holds the (x,y) coordinate, item holds the 
    // closest data item to the event 
}); 

项usualy有足够的信息要为数据项添加工具提示,如属性item.pageX和item.pageY,这些值将保存在属性item.datapoint中,您可以找到访问item.series属性的系列配置(如item.series 。颜色)。