Force Simulation with Voronoi Diagram
An interactive scatterplot maps national GDP and continent onto a force-directed layout of proportional circles. Each country is a node whose position balances simulated attraction, collision, and many-body repulsion forces, and a Voronoi diagram partitions the canvas into cells around the moving nodes. The visualization uses D3 v4’s `d3.forceSimulation`, `d3.forceManyBody`, `d3.forceCollide`, and `d3.voronoi` APIs, rendering SVG circles and paths. Users can drag nodes, which updates the simulation and recomputes the Voronoi tessellation in real time.
AI-generated descriptionThis block uses D3 version 4's d3-force and d3-voronoi to compute the Voronoi diagram for a set of nodes in a force layout as they are dragged around.
For a simple demonstration of the Voronoi diagram, see this block.
For a version of this block without the Voronoi diagram, see this other block.
For more information on the various forces available in D3 v4, see Steve Haroz's d3-force testing ground.
forked from <a href='http://bl.ocks.org/HarryStevens/'>HarryStevens</a>'s block: <a href='http://bl.ocks.org/HarryStevens/2b5d353ad90ef54ca363922013c97618'>Force Simulation with Voronoi Diagram</a>