开发者

Need some guideing regarding hovering pictures

Im going to have a picture and also a datafile that contains information about that picture. The picture is going to be a graph, and the datafile is going to contain a pixel location on that picture and also some information.

So I need to do a javascript that senses what location on the picture that the user has hovered, and then check in the datafile if there are any data avaible in that location. For example say that the user has hovered over pixel (334,55), then it shall lookup in that datafile if that point contains any data.

So do any person out there sit on an example on how to do something like http://img233.image开发者_如何学Pythonshack.us/img233/143/imagecb.jpg?


Why don't you use something like flot?


The basic plan is following:

  1. Define javascript array of points that are derived from your datafile.
  2. Bind mousemove enent to function that takes coordinates and calculates distance from mouse to all elements in that array. Choose nearest element and if distance lower than some value (for example 10px) show tooltip.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜