-
-
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
[BUG] hovermode='x' or 'x-unified' displays information about nearby traces with different 'x' value #4787
Comments
Thanks for bringing this up @lucascibona - I've moved the issue to plotly.js. I don't think we can consider it purely a bug, because there are some cases, primarily when two traces have mismatched x values throughout, where you need this behavior or you'll never see hover data for one of them. But it did come up when we were implementing unified hover that this would be very useful in many situations. In your particular case, you may be able to solve it by concatenating all your |
@alexcjohnson I have tried your suggestion but it doesn't work as intended. I have merged all my Anyway, I guess this is related to the |
Huh, are you sure the upper segments stayed as one trace? I'm not aware of any situation in which we can return multiple hover values from a single scatter trace. Regardless, if the traces have any mismatch of x values (in this case it looks like Jun 26 2018 is missing from the upper & lower) the problem can in principle still occur. |
Sorry to revive such an old issue, but is there somewhere I can see this code running? I've not ever seen this happen and I'm not able to reproduce it... |
I am able to reproduce this with date axes, if not linear axes. |
@netsracJS are you able to provide a runnable example of your code so we can look at what's happening? |
It took some time but here it is: I also figured out that with |
Thanks for the test case! |
It would be fixed by #5668. |
Thanks for fixing @archmoj, when is the next plotly release planned? |
2.0 was released this morning :) |
Hi @alexcjohnson, we met the same issue when we rendered a line chart with about 26280 points. Here is a screenshot We tried to set the hoverinfo = 'none' in plotly_hover event to remove the traces with a different x-value, but it can not remove the traces stably. Is there any way that we can remove the traces that with a different x-value? Thanks for your advice! version: plotly.js-dist-min: 2.26.0 |
Describe the bug
When using
hovermode='x unified'
orhovermode='x'
, I see nearby data from different tracesExpected behavior
I would like to only obtain data that has the same
x
valueScreenshots
In this example, I have a trace "price", a trace "upper" and a trace "lower". At some point, the traces "upper" and "lower" end, and in the next day, new "upper" and "lower" traces begin.
In this screenshot, the expected behavior. I have three traces and it shows the correct data



The problem appears when I hover near the end of one trace and the begin of the next one. Note that the first trace ends on June 26th, the second trace begins on June 27th.
To overcome this problem at least partly I have set
hoverdistance=1
. The problem disappears when I zoom in enough that the traces are well separatedThe text was updated successfully, but these errors were encountered: