-
Notifications
You must be signed in to change notification settings - Fork 12k
Closed
Labels
Description
Thanks to @leeoniya for pointing out that hover performance isn't great. Chart.js does quite poorly on the uPlot benchmark which uses mode: 'index', intersect: false
The logic looks pretty suspect to me. It looks like it iterates over every single element from every dataset and computes the distance between the element and the mouse. At least in the x
direction a much better thing to do would be to get the index for the corresponding value on the scale rather than computing over all data points. Even if in the worst case you had to compute the distance for every index, that'd still be 3x cheaper than computing for every data point (i.e. compute the nearest index once instead of once per dataset)