-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
'catch-all' hover/click events #2696
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
Comments
That's probably an item in #145 about this already. But yeah, this probably deserves an issue of its own. |
I like this idea. One subtlety (at least to me!) that came to mind as I was thinking about this is that in order for the axis coordinates to be meaningful, the identity of the associated axes would need to be included somewhere in the event data. For example, the event data might indicate that the coordinates are with respect to |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
I am currently trying to add this to Plotly.js. I would like to know if there is a way to transform an event into x/y coordinates within a graph axis? The current click does it by acessing a point underneath a click, which is not possible in the case of a click "anywhere". I captured this event with the debugger while hovering over a graph. The event I am talking about is used here: plotly.js/src/components/fx/click.js Line 14 in 72c7f31
This is an example event
I want to obtain the coordinates within the axis as is currently done within
I used the Besides not knowing how to transform a x/y click coordinates to axis coordinates, I have the following ideas:
Let me know what you all think and any help on the above is very welcome. |
omg I need this. |
Is there an update about this issue ? |
I also have been looking for this feature. The onHover option already gives access to the point closest to the mouse position, but I could not do the same for the onClick method. By the way, I'm using plotly with React, in JavaScript. |
One issue with the example workaround is that it doesn't account for padding/margin in parent objects I've taken the example and added a parent div that has both padding and margin on the left side, this then skews the value of the x-axis value, and is clearly something that would need to be handled in such a solution as is suggested here. updated example: I found this issue because I was trying to do something similar for a library I'm working on internally for the company I work for, we want a "hoveron='line'" feature for our scatter plots and I figured I could write that, but I've yet to find a way to handle parent padding/margins. |
It'd be awesome to have dedicated events for obtaining the mouse position (in graph paper/axis coordinates) upon clicking/hovering anywhere on a plot.
This could be useful for many things, including adding annotations on click in a dash/shiny application. In fact, the R community is used to having this capability for any static figure in a shiny application.
PS. this is a feature request related to some existing threads, but was surprised that I couldn't find an existing GH issue
The text was updated successfully, but these errors were encountered: