How do I hide a tooltip using the mouseout event?


« Back to message list

Enter your email address to get email updates on this topic. You can stop receiving updates by clicking the link in the update email messages.

Posted by Jean Ti on 2nd January 2018
Hello Richard,
An Happy 2018 New Year first, of course.

I'm using your SVG graph, line part for the moment.
I looked for long time to find how to hide the tooltip on mouseout, in plus of the mouse click, but without finding how to do for SVG here or in the web.
So I added this in your tooltip.js :

         // Add the body mouseout handler that clears the tooltip JT 2017-01-02
         document.body.addEventListener('mouseout', function (e)
         {
                 setTimeout(function(){ RG.SVG.hideTooltip(); }, 2000);
         }, false);

It works well for me.
I added timeout to avoid trouble depending of mouse position in the line.

What to you think about this code, could I have some unexpected behaviors somewhere else ?

Thanks for yout great work with RGraph and hope you will continue to improve the SVG part ( more natural graph resizing for responsive page for example...)
Posted by Richard on 2nd January 2018
Hi there,

Happy new year.

Yes seems fine - I'm assuming that you're happy for the tooltip to disappear as soon as you move the mouse away from the point.

Richard

Add a reply




« Back to message list