Skip to content

Commit

Permalink
[ML] fix the annotation area tooltip offset (#55955)
Browse files Browse the repository at this point in the history
  • Loading branch information
darnautov authored Jan 27, 2020
1 parent 987dfbc commit 94297f3
Showing 1 changed file with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1623,8 +1623,20 @@ const TimeseriesChartIntl = injectI18n(
});
}

let xOffset = LINE_CHART_ANOMALY_RADIUS * 2;

// When the annotation area is hovered
if (circle.tagName.toLowerCase() === 'rect') {
const x = Number(circle.getAttribute('x'));
if (x < 0) {
// The beginning of the annotation area is outside of the focus chart,
// hence we need to adjust the x offset of a tooltip.
xOffset = Math.abs(x);
}
}

mlChartTooltipService.show(tooltipData, circle, {
x: LINE_CHART_ANOMALY_RADIUS * 2,
x: xOffset,
y: 0,
});
}
Expand Down

0 comments on commit 94297f3

Please sign in to comment.