You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[BUG]: scattergl and splom hover ignores marker size for overlapping points #8082
If markers of different sizes overlap, scatter and scattergl show different hover labels. scatter includes the marker radius in the hover distance, and a smaller marker wins while the pointer is near its center (src/traces/scatter/hover.js). scattergl and splom measure only the distance to the marker center, so the marker drawn on top always wins. scatterpolargl inherits this through scattergl.
scattergl also uses a plain |dx| in x hovermode, but scatter changes the shape of dx inside the marker radius. That difference can rank close points differently.
This is a follow-up to #8077, which fixed ties between equal distances.
I reproduced this on main (90f954a) with real pointer events in Chrome, and I have a fix ready if you'd like a PR.
It follows your notes:
I moved the existing dx/dy/dxy math in scatter/hover.js into two exported functions, getAxisDistance and getPointDistance, without changing it. scattergl and splom now score points with them. Each radius is half of the sizes/size that convert already computes for the WebGL markers.
When scattergl uses the spatial index, the search box grows by the largest marker radius.
scatterpolargl gets the fix through scattergl.
Before and after, comparing the WebGL trace with its SVG counterpart:
Case
SVG
WebGL on main
WebGL with the fix
your snippet (A size 6, B size 20, pointer at the center)
A
B
A
one trace, sizes [6, 20] at the same point
small
big
small
big marker drawn first, pointer 8px from the center
B
A
B
splom, sizes [6, 20]
—
big
small
scatterpolargl vs scatterpolar, sizes [6, 20]
small
big
small
1e5-point trace, pointer 30px inside an 80px marker
big
no hover
big
About the blast radius: with markers of equal size, ties still go to the trace drawn last (#8077). Two things change for every WebGL plot with markers:
A point counts as in range when the pointer is within hoverdistance of the marker's edge, as in scatter.
spikedistance and the label order in x hovermode use the same scoring as scatter.
When the pointer is inside several markers of the same size, the point drawn last wins, as in scatter. Before, WebGL picked the nearest center. This changed five expectations in scatterpolargl_test.js. Their default pointer is 3.7px from point 2 and 5.8px from point 26 of 'Trial 3', and both markers have a 6px radius. scatterpolar picks point 26 for the same figure, and scatterpolargl now does too.
The hover label still anchors at the marker center in WebGL. scatter anchors it at the edge. I left that out to keep this change focused.
Activity
adimalkar commentedon Nov 11, 2026
I reproduced this on
main(90f954a) with real pointer events in Chrome, and I have a fix ready if you'd like a PR.It follows your notes:
dx/dy/dxymath inscatter/hover.jsinto two exported functions,getAxisDistanceandgetPointDistance, without changing it.scatterglandsplomnow score points with them. Each radius is half of thesizes/sizethatconvertalready computes for the WebGL markers.scattergluses the spatial index, the search box grows by the largest marker radius.scatterpolarglgets the fix throughscattergl.Before and after, comparing the WebGL trace with its SVG counterpart:
main[6, 20]at the same pointsplom, sizes[6, 20]scatterpolarglvsscatterpolar, sizes[6, 20]About the blast radius: with markers of equal size, ties still go to the trace drawn last (#8077). Two things change for every WebGL plot with markers:
hoverdistanceof the marker's edge, as inscatter.spikedistanceand the label order inxhovermode use the same scoring asscatter.scatter. Before, WebGL picked the nearest center. This changed five expectations inscatterpolargl_test.js. Their default pointer is 3.7px from point 2 and 5.8px from point 26 of 'Trial 3', and both markers have a 6px radius.scatterpolarpicks point 26 for the same figure, andscatterpolarglnow does too.The hover label still anchors at the marker center in WebGL.
scatteranchors it at the edge. I left that out to keep this change focused.