x-unified hover skips a level for data with different lengths
See original GitHub issueSynopsis
This is rather difficult to describe, but I’ll give it a go and use visual aids to convey it.
Given the following:
hovermode: "x unified"
- There are many data points on the graph - roughly >100.
- There are two sets of data - i.e. one visualised as bar and one as line - and one of the two ends before the other.
As you approach the end of the x-axis, the hover jumps one level as the shorter dataset ends.
Examples
You can see an example of the issue on our live service. There is also an alternative description of the issue in our repository.
The issue basically boils down to this:
In the animation, you can see that when hovering from 3 May to the right, the next point is skipped and then the successive point for 5 May is then displayed. This happens even if you manage to hover exactly over the bar for 4 May.
Exceptions
The issue resolves itself if you zoom into the data (x-axis zoom).
Expected behaviour
The tooltip should be displayed for all successive points and jump one step at a time.
Additional info
In case it helps, the code for the visualisation can be found here.
Issue Analytics
- State:
- Created 2 years ago
- Comments:16 (8 by maintainers)
Top GitHub Comments
“no longer snappy” doesn’t really sound great, but if you’re happier with the behaviour I’ll take it 😉
happy to help, and happy to chat with you 1-1 if there’s anything else I or anyone on the Plotly team can do to support your important work 💪
OK, I see what’s happening. I think the behaviour is very slightly improved in 2.0 but it’s still not doing what you’d like. Internally, the scatter trace is taking precedence and because the default
layout.hoverdistance
is 20, there’s some radius beyond which it’s overriding the bars. I’ll think about a better default behaviour a little bit, but in the meatime, for your specific charts which have a fully-dense coverage using bars, I think that settinglayout.hoverdistance=1
or some other small number will get you what you need.