[英]Determine plot of flot point
I have a flot graph with a few different plots in it. 我有一个带有一些不同曲线的浮点图。 There is interactivity that triggers an event when a point is hovered over, a la http://www.flotcharts.org/flot/examples/interacting/ .
在将鼠标悬停在某个点上时,会交互触发一个事件,例如http://www.flotcharts.org/flot/examples/interacting/ 。 Is there any on-hand way of determining which plot the event's point came from, short of coloring all plots uniquely and getting at the point's color?
是否有任何简便的方法可以确定事件点来自哪个绘图,而无需唯一地为所有绘图着色并获得该点的颜色?
If you look at the script on that page you have this binding for the plothover
event: 如果您查看该页面上的脚本,则具有
plothover
事件的此绑定:
$("#placeholder").bind("plothover", function (event, pos, item)
The item
is the actual point you are hovering over (or null if you are not over a point). 该
item
是您要悬停的实际点(如果未悬停在某个点,则为null)。 That object contains all the data you need including both series
which gives you the series it belongs to (which I assume is what you meant by plot
) and seriesIndex
. 该对象包含你需要既包括了所有的数据
series
,让你所属的系列(我假设是您的意思plot
)和seriesIndex
。
The actual description of the item
object is kind of hidden in the documentation : item
对象的实际描述有点隐藏在文档中 :
item: {
datapoint: the point, e.g. [0, 2]
dataIndex: the index of the point in the data array
series: the series object
seriesIndex: the index of the series
pageX, pageY: the global screen coordinates of the point
}
Also note: "The item object in this example is either null or a nearby object on the form" 另请注意:“此示例中的item对象为null或表单上的附近对象”
How near "nearby" is depends on the mouseActiveRadius
“附近”附近的距离取决于
mouseActiveRadius
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.