diff --git a/src/components/fx/hover.js b/src/components/fx/hover.js index 3d326d007cc..d1a360c9660 100644 --- a/src/components/fx/hover.js +++ b/src/components/fx/hover.js @@ -1124,10 +1124,6 @@ function alignHoverText(hoverLabels, rotateLabels) { tx2x = txx + alignShift * (d.txwidth + HOVERTEXTPAD), offsetX = 0, offsetY = d.offset; - if(d.anchor === 'middle') { - txx -= d.tx2width / 2; - tx2x -= d.tx2width / 2; - } if(rotateLabels) { offsetY *= -YSHIFTY; offsetX = d.offset * YSHIFTX; diff --git a/test/image/mocks/centered-tooltips.json b/test/image/mocks/centered-tooltips.json new file mode 100644 index 00000000000..7ccc8cb44c5 --- /dev/null +++ b/test/image/mocks/centered-tooltips.json @@ -0,0 +1,58 @@ +{ + "data": [ + { + "y": [ + 1, + 2, + 6, + 3, + 5, + 6 + ], + "x": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "text": [ + "short label", + "short label", + "Very long label named San Francisco", + "Very long label named San Francisco", + "Very long label named San Francisco" + ] + }, + { + "y": [ + 6, + 5, + 1, + 4, + 1, + 0 + ], + "x": [ + 0, + 1, + 2, + 3, + 4, + 5 + ], + "text": [ + "short label", + "short label", + "Very long label named San Francisco", + "Very long label named San Francisco", + "Very long label named San Francisco" + ] + } + ], + "layout": { + "width": 400, + "height": 300 + } +}