The tooltip onmousemove handler in the SVG Bar/HBar gets overwritten


« 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 Jan Dirk on 18th January 2017
Goodmorning,

I tried your new SVG bar/hbar graphs.
I noticed that the tooltips were not showing, on the mousemove event, although I had defined as such.

After digging into it, I found the problem, I think:

The code is:

                                 rect['on' + prop.tooltipsEvent] = function (e)
                                 {
                                     // Hide any tooltip that is currently visible
                                     RG.SVG.hideTooltip();

                                     // Show the tooltip
                                     RG.SVG.tooltip({
                                         object: obj,
                                         group: idx,
                                         index: indexes[1],
                                         sequentialIndex: seq,
                                         text: prop.tooltips[seq],
                                         event: e
                                     });

                                     // Highlight the rect that has been clicked on
                                     obj.highlight(e.target);

                                 };

                                 rect.onmousemove = function (e)
                                 {
                                     e.target.style.cursor = 'pointer'
                                 };

In my case, prop.tooltipsEvent="mousemove". This means that first on the SVG-rect the onmousemove handler is defined as the handler showing the tooltip, but is than overwritten with a handler setting the cursor-style to 'pointer'.
This means that the tooltip is not shown.
After I commented out the last 4 lines, my tooltip was indeed shown on mouse over.

Regards,

Jan Dirk
Posted by Richard on 18th January 2017
Hi there,

Thanks for letting me know. I've now converted the Bar and HBar to use addEventListener instead of DOM1 style events and I'll convert the rest for the next release.




Richard
Posted by Jan Dirk on 18th January 2017
Thanks and regards,

Jan Dirk

Add a reply

 




« Back to message list
RGraph on social media