by _ls7m · 12y ago · 0 comments
For both they are using D3's built-in voronoi function which will generate the appropriate interaction regions when given a list of points. These polygonal regions surround the given points and fill the graph, acting as large unmissable mouseover targets instead of the tiny points. It's really useful. https://github.com/mbostock/d3/wiki/Voronoi-Geom
More on voronoi tessalation http://en.wikipedia.org/wiki/Voronoi_diagram
1) building a Voronoi tessellation from the given points
2) at each mouse movement perform point-in-polygon queries on all polygons until found
3) rebuild Voronoi as data changes
or 1) at each mouse movement calculate distance-to-point for each point
2) select the shortestk-d trees sound closer to what you'd want to do cursor coordinates to scatter plot point lookups.