Skip to content

Commit ad38f8d

Browse files
committed
fix and comment on bar positionFn passVal
1 parent a2fc07a commit ad38f8d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/traces/bar/hover.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ module.exports = function hoverPoints(pointData, xval, yval, hovermode) {
5252
};
5353

5454
function _positionFn(_minPos, _maxPos) {
55+
// add a little to the pseudo-distance for wider bars, so that like scatter,
56+
// if you are over two overlapping bars, the narrower one wins.
5557
return Fx.inbox(_minPos - posVal, _maxPos - posVal,
56-
maxHoverDistance - Math.min(1, Math.abs(_maxPos - _minPos) / pRangeCalc));
58+
maxHoverDistance + Math.min(1, Math.abs(_maxPos - _minPos) / pRangeCalc) - 1);
5759
}
5860

5961
function positionFn(di) {

0 commit comments

Comments
 (0)