Skip to content

Commit 118b97a

Browse files
committed
spikeline: fix bar calculation of spikedistance
1 parent 486d254 commit 118b97a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/traces/bar/hover.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ function hoverOnBars(pointData, xval, yval, hovermode) {
160160
pointData.valueLabel = hoverLabelText(sa, pointData[sizeLetter + 'LabelVal']);
161161

162162
// spikelines always want "closest" distance regardless of hovermode
163-
pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2;
163+
pointData.spikeDistance = (sizeFn(di) + thisBarPositionFn(di)) / 2 - maxHoverDistance;
164164
// they also want to point to the data value, regardless of where the label goes
165165
// in case of bars shifted within groups
166166
pointData[posLetter + 'Spike'] = pa.c2p(di.p, true);

0 commit comments

Comments
 (0)