Subplots Hover problem with closest data

Hello guys!
Here in example a code with a multi subplots graph. If you use compare data everything it’s ok but if you use closest data it seems not works properly.
http://codepen.io/Narghast/pen/pypRxG

I want to report also that in case of subplots hover and “overlaying” options there are some abnormalities in the print of the hover labels, sometimes they overlap. This happen if you use Plotly.Fx.hover() otherwise the rendering of the labels appear correctly without overlap. I don’t know how to reproduce this problem, but i think that the function for plotting the labels in the case of “compare data” is different from Pltoly.Fx.hover().

There are something wrong in the code? I’m the only one with this problem?

Thank you for the support!

The call Fx.hover call signature would have to be different when layout.hovermode is set the 'closest' in order to work properly.

See example: https://plot.ly/javascript/hover-events/#triggering-hover-events

1 Like

Hm sorry but i don’t see the solution.
There’s a way to know if the plot is in “closest” mode or “compare” mode?

Yes. Something like;

graph.on('plotly_hover', function (eventdata){
       if(graph.layout.hovermode === 'x') {
           /* do as before */
       }
       else if(graph.layout.hovermode === 'closest') {
           /* use call signature of https://plot.ly/javascript/hover-events/#triggering-hover-events */
       }
    });
1 Like

Thanks man. Quite interesting. I was looking at something along this line but different, Two graphs one Hover. What I had in mind was two different graphs with different hovers, say a bar graph on the axis below and a line graph above. The closest I ever got was two subpots but each with a different hover. See also https://github.com/plotly/plotly.js/issues/2114

Hi Narghast,
My data is similar to your . can You please past your code.

Thanks
Venkat