DEV Community

Cover image for BUG: React Chartjs blinking
Visakh Vijayan
Visakh Vijayan

Posted on • Updated on

BUG: React Chartjs blinking

We are using react-chartjs in our project and managed to create beautiful charts. Lately we noticed when we hovered on a section of the graph it started showing a dot at some other points as well. Here is a video showing the same.

https://res.cloudinary.com/dycur35xt/video/upload/v1622818945/Recording__123_oukaib.mp4

Just in case someone is facing the same issue, we solved it using a little tweak in the chart options

hover:
{
    mode: 'index',
    axis: 'x',
    intersect: false,
    animationDuration: 50
}
Enter fullscreen mode Exit fullscreen mode

I am not quite sure what animationDuration it does, but I am assuming it is the number of milliseconds for which dot should be shown after losing focus.

Anyways this solved the problem.

Top comments (0)