Skip to main content
100%

d3 force states v4

✓ Published0🌍 Public
FFrissAnalytics
Last edited Jan 25, 2020
Created on Jan 25, 2020

This example uses D3 v4’s force simulation to create a draggable, distorted map of the lower 48 U.S. states. It first draws the state boundaries as SVG paths using `d3.geoPath` and TopoJSON data from `us-10m.v1.json`, then computes state centroids and connects neighboring states via a Voronoi tessellation (`d3.voronoi`). The simulation applies `d3.forceManyBody`, `d3.forceLink`, and `d3.forceCenter` to let users pull states apart while maintaining link distances. The view shows the map’s shapes and links shifting dynamically as the simulation runs, with drag interactions handled by `d3.drag`.

AI-generated description

Built with blockbuilder.org

mit Licensed

Similar vizzes