fix ai + chart + events

This commit is contained in:
Emily
2024-10-01 14:25:56 +02:00
parent a08624b69b
commit dad8c521ee
6 changed files with 33 additions and 10 deletions

View File

@@ -123,8 +123,14 @@ function externalTooltipHandler(context: { chart: any, tooltip: TooltipModel<'li
return;
}
const { left: positionX, top: positionY } = chart.canvas.getBoundingClientRect();
const xSwap = tooltip.caretX > (window.innerWidth * 0.5) ? -450 : -100;
tooltipEl.style.opacity = '1';
tooltipEl.style.left = positionX + tooltip.caretX + 'px';
tooltipEl.style.left = positionX + (tooltip.caretX + xSwap) + 'px';
tooltipEl.style.top = positionY + tooltip.caretY + 'px';
tooltipEl.style.padding = tooltip.options.padding + 'px ' + tooltip.options.padding + 'px';