Skip to content

Commit 2684d69

Browse files
author
Jon M. Mease
committed
Fix path tooltip direction when graph div is offset from left margin
Get mouse x position relative to graph div rather than relative to page
1 parent 4bc3d35 commit 2684d69

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/traces/parcats/parcats.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -446,6 +446,7 @@ function mouseoverPath(d) {
446446
}
447447

448448
var hovertext = hovertextParts.join('<br>');
449+
var mouseX = d3.mouse(gd)[0];
449450

450451
Fx.loneHover({
451452
x: hoverCenterX - rootBBox.left + graphDivBBox.left,
@@ -456,7 +457,7 @@ function mouseoverPath(d) {
456457
fontFamily: 'Monaco, "Courier New", monospace',
457458
fontSize: 10,
458459
fontColor: textColor,
459-
idealAlign: d3.event.x < hoverCenterX ? 'right' : 'left'
460+
idealAlign: mouseX < hoverCenterX ? 'right' : 'left'
460461
}, {
461462
container: fullLayout._hoverlayer.node(),
462463
outerContainer: fullLayout._paper.node(),

0 commit comments

Comments
 (0)