Skip to main content
100%

Voronoi-based point picker (revisited)

✓ Published0🌍 Public
KKcnarf
Last edited Dec 3, 2018
Created on Jun 21, 2016

This example demonstrates a Voronoi diagram where each point’s interactive zone is limited by a maximum radius, adjusted via a slider. It shows how hovering over a polygon highlights the corresponding data point. The visualization uses the `d3.distanceLimitedVoronoi` plugin to compute these clipped regions, replacing the need for clip paths. The code generates 100 random vertices, renders the polygons and circles using D3.js v4, and redraws the diagram in response to slider input.

AI-generated description

This block is based on Voronoi-based point picker from njvack

This block uses the d3.distanceLimitedVoronoi d3 plugin I made. This plugin produces the appropriate interactive zones, depending on the Voronoï tesselation and a maximum distance from each datum.

Compared to the original block, there is no need to produce and bind clipPathes, making the code (and usage) simpler.

Acknowledgments to:

gpl-3.0 Licensed

Similar vizzes