-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
Falsy hovermode and/or hoverinfo should not disabe click event data #313
Comments
@etpinard nice manual test case! Forked it into http://codepen.io/monfera/full/KzXNzy/ because original didn't run (a comma accidentally deleted). I could reproduce the problem. Looking into the possible cause. |
I made a change that results in the callback being called, but the proper solution is something else. The click callback would be called, but it isn't because eventData is set to undefined (and usually no point to have a click handler if we don't know what we click on). It's the |
…otherwise hoverinfo will be undefined
This little change solves the reported problem for one of the conditions: when the hoverinfo is set to 'none'. https://github.com/monfera/plotly.js/pull/2/files The problem is that the term 'hover' is used a bit inconsistently, as some bindings seemingly named to 'hover' are also used ultimately in the click handler. So once the bug is fixed, we might consider a name disambiguation. Looking into the other condition (hovermode is falsey) which didn't yield on the first attempt. |
@etpinard the root cause analysis and the |
@monfera Is there a way I could implement your solution as a temporary fix for my plots? |
@abalter This issue is under resolution, however this specific commit in my fork appears to fix the issue when If it's helpful, use this small commit in your checkout, run |
…if hoverinfo is set to none
…e hover info even if hovermode is set to false
… wasn't enough sometimes
@etpinard I'm just jotting down my current thinking as it hasn't crystallized yet and maybe some of the points remind you of some important aspect or just suggest which way to go. My earlier comment described that solving I made code changes such that tooltips do not show up but the appropriate data is still collected. It almost works, save for the following problem: in your cited codepen example, the cartesian line graph has two points (x=1, x=3) where the y value is the same (y=2). Clicking on (x=3,y=2) returns data as though I clicked on (x=1,y=2). It works fine if I supply data with unique y values. I think the problem is that when hovermode is false, it won't run in the proper code path and maybe thinks the y axis is the independent axis (perhaps because hovermode !== 'x'), and finds the first match. I see two options:
My lack of confidence about deeper changes is due to various challenges. e.g.:
For these reasons, unless you suggest otherwise, I'm about to try solution 2) which would take care of the hovermode and hoverinfo value via coercion: if hovermode is false, set hovermode to |
@monfera thanks again for a very detailed and 💎 clear writeup. One could argue that Manoeuvring around the fact that our the same picking algorithm feeds the hover labels and the event data for The Before finding a more appropriate solution to |
…on of the hover info even if hovermode is set to false" This reverts commit a045927.
… preexisting option "hoverinfo" : "none"
See http://codepen.io/etpinard/pen/zqvOav?
N.B. this issue only occurs for cartesian trace types it looks like.
The text was updated successfully, but these errors were encountered: