-
-
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
Fix hover with period alignment points and improve positioning of spikes and unified hover label #5846
Conversation
This looks good AFAICT! @alexcjohnson can we get an expedited review plz? |
'bar : 1' | ||
]}); | ||
|
||
_hover(gd, { xpx: 210, ypx: 200 }); | ||
assertLabel({title: 'Jan', items: [ | ||
'bar : (Jan 1, 2000, 1)', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line 5348 has a typo that's making this test confusing (xhoverfrmat
)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good eye. Addressed in 7c37e98.
Looking specifically at the test I commented on above but having fixed the typo, here's the behavior on master: Here's the behavior currently with this PR: I thought at one point we had the idea that a period-positioned scatter trace should behave like a bar for hover purposes, in that any given point should be included in the hover whenever your cursor is over the period it represents. Did we drop that idea? |
Yes, here are the period-positioning invariants: #5553 The behaviour you note above is indeed troubling. Which mock is this? |
I'm also seeing some odd spikeline/hover mismatches in the all-bar case: https://codepen.io/nicolaskruchten/pen/bGWoVKB?editors=0010 |
It's this, from the test I commented on: var scatterType = 'scatter';
Plotly.newPlot(gd, {
data: [
{
name: 'bar',
type: 'bar',
x: ['2000-01', '2000-02'],
y: [1, 2],
xhoverformat: '%b',
xperiod: 'M1'
},
{
name: 'start',
type: scatterType,
x: ['2000-01', '2000-02'],
y: [1, 2],
xhoverformat: '%b',
xperiod: 'M1',
xperiodalignment: 'start'
},
{
name: 'end',
type: scatterType,
x: ['2000-01', '2000-02'],
y: [1, 2],
xhoverformat: '%b',
xperiod: 'M1',
xperiodalignment: 'end'
},
],
layout: {
showlegend: false,
width: 600,
height: 400,
hovermode: 'x unified'
}
}) |
Agreed with Alex's point above: the hoverlabel should always be to the side of the spikeline (as it is on master I believe) |
With this build, I don't seem to be able to hover on the left-most points in the figure from #5822 ... see https://codepen.io/nicolaskruchten/pen/MWmEzeJ?editors=0010 |
Good catch. Thank you! |
Good idea. Applied in 16f4554. |
I think this is a case of the spike line not matching the hover-winning point, which is indeed a bug, and it seems worse with this PR than on master. Can we see if there's a fix for it plz? |
That's simply because of "When the scatter point wins, it's ok for the hovelabel to occlude the bar" logic added in 16f4554. Without it there would be no occlusion with spikeline :) |
This is also true : ) |
Let's try to fix the spike line position too please before merging this. It should not be possible for the spike line to be on a different point that the winning point: there's a specific attribute for that. |
On it. |
Done in dca5b1e. |
- also adjust scattergl and splom hover label position
Closer! So in this pen: https://codepen.io/nicolaskruchten/pen/xxdPKwZ?editors=0010 when I hover over the left-most point I get no bar in the hoverlabel, and when I hover on the next point I get the left-most bar in the hoverset. This is even more apparent when I should add that the vertical position over the hoverlabels seems too low in this pen: https://codepen.io/nicolaskruchten/pen/QWvOLjJ?editors=0010 ... the hoverlabel is always around the bottom two points for me. |
Good catch. Fixed in df6353d |
That's a bug. |
Addressed in 9217db4. |
OK, this last set of changes nails down everything I care about! There's still some oddity around end-positioned grouped-bars but we can leave that out for now. @alexcjohnson over to you, again :) |
…riod_positioning9 mock & horizontal variant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💃 I think we have a winner! 🏆
Fixes #5822, fixes #5841 and fixes #5721.
@plotly/plotly_js