Skip to content

Commit c692eda

Browse files
committed
use winning point position in unified hover instead of mean
1 parent 391074b commit c692eda

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/components/fx/hover.js

+3-2
Original file line numberDiff line numberDiff line change
@@ -1059,8 +1059,9 @@ function createHoverText(hoverData, opts, gd) {
10591059
legendDraw(gd, mockLegend);
10601060

10611061
// Position the hover
1062-
var ly = Lib.mean(hoverData.map(function(c) {return (c.y0 + c.y1) / 2;}));
1063-
var lx = Lib.mean(hoverData.map(function(c) {return (c.x0 + c.x1) / 2;}));
1062+
var winningPoint = hoverData[0];
1063+
var ly = (winningPoint.y0 + winningPoint.y1) / 2;
1064+
var lx = (winningPoint.x0 + winningPoint.x1) / 2;
10641065
var legendContainer = container.select('g.legend');
10651066
var tbb = legendContainer.node().getBoundingClientRect();
10661067
lx += xa._offset;

0 commit comments

Comments
 (0)