79291000

Date: 2024-12-18 12:02:11
Score: 1
Natty:
Report link

As a solution, I stopped using the external callback and instead added an event listener:

chart.canvas.addEventListener('mousemove', chartHovering);

In the chartHovering function, I locate the nearest x-axis tick based on the mouse position, then use its datetime to find the corresponding element from the dataset.

After that, I proceed to build my custom tooltip as before.

Reasons:
  • Has code block (-0.5):
  • Self-answer (0.5):
  • Low reputation (1):
Posted by: gifteddiz