kensho-technologies / orama

Plug and play React charts

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Compute data hover using voronoi diagram

billyjanitsch opened this issue · comments

Profiling the stress test in #123, I noticed that 40% of each frame is spent calling isPointInStroke to compute which datum the mouse is hovering over. (This use of isPointInStroke is also the only reason that orama requires a polyfill to support IE 11, AFAIK.)

screen shot 2018-06-06 at 7 44 58 pm

Instead of this canvas-based approach, we could collapse all data into a voronoi diagram, and use it to determine the closest datum to a given mouse position, which would be relatively instantaneous. Here's an example of that approach.

(This would change the existing hover behavior, arguably for the better.)