Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should we expose an official version of Fx.hover that works for all subplot types? #1963

Open
kyle-strait opened this issue Aug 18, 2017 · 5 comments
Labels
feature something new P3 not needed for current cycle

Comments

@kyle-strait
Copy link

Hello,

I recently switched my app from using scatter to scattergl and realized that the Fx.hover method does not work correctly for that plot type. This codepen shows that the change to scattergl breaks the hover call. I did not see this listed anywhere as a gl2d limitation so I wanted to get it out there. I also realize that the plan is for Fx to be removed in the future however I was hoping there may be some plan to amend the hover method to work with scattergl.

A quick look through made it seem like one of the sticking points is that the hover method is looking for a "hoveron" field in the trace which is not present for scattergl. It is then set to an empty string and the hover code moves on without looking for any points to execute the hover on.

Thanks!

@etpinard
Copy link
Contributor

That's correct, Fx.hover only works for cartesian subplots (and maybe pie - I don't remember).

You can try using Fx.loneHover the same way our gl2d code invokes it to get the desired result.

Fx.hover is one our unofficial methods that we'll remove in v2, maybe we should we should consider adding an official Plotly.hover method?

@etpinard etpinard changed the title Fx.hover does not work for scattergl Should we expose and official version of Fx.hover that works for all subplot types? Aug 21, 2017
@kyle-strait
Copy link
Author

Hi @etpinard thank you for your reply.

I will give Fx.loneHover a try and see if I can get it to do what we need.

As for an official Plotly.hover method I personally think it could be very helpful. In our case we have points that are being used in multiple locations (i.e. a map and the plots) and they are linked. I am currently using the hover capabilities to perform "highlighting" when there is a hover on a point in a map that links to a point on the plot. I don't know how common of a use case that is but it is pretty key to the application we are working on.

@lnunno
Copy link

lnunno commented Apr 2, 2018

It'd be nice if this was mentioned in the Plotly docs since the official docs use Fx.hover directly with no mention of scattergl. I concur that a Plotly.hover method would be helpful.

@arlowhite
Copy link

arlowhite commented Oct 8, 2018

@etpinard where is the scattergl code that creates hovers in compare mode?
(such that the labels don't overlap each other)
Looking at loneHover, I don't see how it deals with multiple points.

EDIT it seems to be _hover(), but I'm confused how it works because Plotly.Fx.hover() doesn't work with scattergl traces.

I noticed there's Fx.multiHovers, but it only seems to be used in parcats.js, not sure if this is what I want.

All I want to do is achieve the same behavior as compare mode, but across multiple subplots sharing the same x axis. It'd be nice if there was an option for this. e.g. hovermode: 'across' on the xaxis

@philtgun
Copy link

Any updates on this issue? In my case, my goal is to trigger hover event on the scattergl plot for comparison, and hover() doesn't work with scattergl, and loneHover() is too cumbersome to use at a high level, and there is not much documentation available except for the code. But apparently, that is the only way to do things at the moment?

@nicolaskruchten nicolaskruchten changed the title Should we expose and official version of Fx.hover that works for all subplot types? Should we expose an official version of Fx.hover that works for all subplot types? Jan 19, 2021
@gvwilson gvwilson self-assigned this Jun 10, 2024
@gvwilson gvwilson removed their assignment Aug 2, 2024
@gvwilson gvwilson added P3 not needed for current cycle and removed status: discussion needed labels Aug 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature something new P3 not needed for current cycle
Projects
None yet
Development

No branches or pull requests

6 participants