vega / vega-lite

A concise grammar of interactive graphics, built on Vega.
https://vega.github.io/vega-lite/
BSD 3-Clause "New" or "Revised" License
4.7k stars 618 forks source link

Projected nearest should not need a Voronoi transform #7868

Open domoritz opened 2 years ago

domoritz commented 2 years ago

A common interaction is to show a line chat with a line for a tooltip at the x-location of some data. https://vega.github.io/vega-lite/examples/interactive_multi_line_pivot_tooltip.html is an example of such a chart and it uses a projected nearest selection. Since we only need to find the closest point on x, we don't really need a full Voronoi tessellation of the space. We could find the closest point with just a binary search (assuming the data is sorted) for example.

domoritz commented 2 years ago

@arvind am I missing something here? Voronoi seems overkill for the simple case of finding the nearest point along an axis.