Skip to main content
100%

Modifying a Force Layout with Voronoi Polygons for Dragging and Mouseover of Grouped Elements

✓ Published0🌍 Public
FFrissAnalytics
Last edited Sep 29, 2018
Created on Sep 29, 2018

This example demonstrates a D3 v4 force-directed graph whose three nodes can be dragged individually, while a Voronoi polygon behind each grouped element expands the clickable and hover area. Hovering activates a node's entire group, highlighting its circle and revealing its hidden text label. The simulation uses `d3.forceSimulation` with charge, link, and center forces, and recomputes the Voronoi overlay on every tick via `d3.voronoi`. The code dynamically adds and removes nodes and links on timed intervals using `d3.interval` and `d3.timeout`, updating the SVG paths, lines, and circles accordingly.

AI-generated description

Built with blockbuilder.org

forked from <a href='http://bl.ocks.org/dunderjeep/'>dunderjeep</a>'s block: <a href='http://bl.ocks.org/dunderjeep/65366fb7a4946f3b8ef9dbef2a63951b'>Modifying a Force Layout with Voronoi Polygons for Dragging and Mouseover of Grouped Elements</a>

See also this stack overflow question.

mit Licensed

Similar vizzes