Skip to main content
100%

d3-force-cluster and d3-force-attract

✓ Published0🌍 Public
AAlainRo
Last edited May 28, 2018
Created on May 28, 2018

This example demonstrates a force-directed graph of 200 colored nodes organized into 10 clusters, using both `d3.forceAttract` to pull nodes toward the center and `d3.forceCluster` to group them by color. The simulation runs with `d3.forceSimulation`, while collision strength ramps up over three seconds for a smooth transition. Nodes are rendered as SVG circles with a rainbow sequential color scale, and dragging updates node positions via `d3.drag`. The data is generated randomly with cluster-specific radii and initial angular placement.

AI-generated description

Example illustrating the use of both d3-force-attract and d3-force-cluster.

forked from <a href='http://bl.ocks.org/ericsoco/'>ericsoco</a>'s block: <a href='http://bl.ocks.org/ericsoco/d2d49d95d2f75552ac64f0125440b35e'>d3-force-cluster + d3-force-attract I</a>

mit Licensed

Similar vizzes