Skip to content

Commit 8a36d8f

Browse files
committed
position hover labels in respect to max and min of hoverset not the winning point
1 parent 9fbd186 commit 8a36d8f

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

src/components/fx/hover.js

+2-3
Original file line numberDiff line numberDiff line change
@@ -1071,12 +1071,11 @@ function createHoverText(hoverData, opts, gd) {
10711071
legendDraw(gd, mockLegend);
10721072

10731073
// Position the hover
1074-
var winningPoint = hoverData[0];
10751074
var ly = axLetter === 'y' ?
1076-
(winningPoint.y0 + winningPoint.y1) / 2 :
1075+
Math.min.apply(null, hoverData.map(function(c) {return c.y1;})) :
10771076
Lib.mean(hoverData.map(function(c) {return (c.y0 + c.y1) / 2;}));
10781077
var lx = axLetter === 'x' ?
1079-
(winningPoint.x0 + winningPoint.x1) / 2 :
1078+
Math.max.apply(null, hoverData.map(function(c) {return c.x1;})) :
10801079
Lib.mean(hoverData.map(function(c) {return (c.x0 + c.x1) / 2;}));
10811080

10821081
var legendContainer = container.select('g.legend');

0 commit comments

Comments
 (0)