I'm making a line chart in oCanvas, and I need to show the data of a point of the line, when the user hovers that point with his mouse! Is there like a built-in function for it do it itself, or do I have to make it myself? (I didn't find any useful info on the docs section of the website, and that's why I came here, just in case someone has done it before me and knows how to do it!). I have the data I need to display when the user hovers the point, I just can't get find a hover function. After that I need to show something like a tooltip, that's gonna contain the data. Thank you very much for your help, it is really useful to me! Here's the website: http://ocanvas.org/
Asked
Active
Viewed 79 times
1 Answers
0
oCanvas is a general purpose library, so there is no built-in feature for that. To make hover work, you need to listen to events (mouseenter and mouseleave): http://ocanvas.org/docs/Events/Mouse
When you detect mouseenter you will need to show the tooltip object in the correct position. When you later detect mouseleave you will need to hide the tooltip.

Johannes Koggdal
- 51
- 2
-
Is there a way to track where the cursor is? In order to have the tooltip, above the cursor! – Jim The Greek Feb 02 '16 at 11:49
-
Yes, use the mousemove event and access either event.x or canvas.mouse.x. – Johannes Koggdal Feb 02 '16 at 14:33