Radial Force
This example demonstrates custom radial forces in D3, positioning red nodes on a circle of radius 100 pixels and blue nodes on a radius of 200 pixels, with reference circles drawn as SVG paths. It uses `d3.forceSimulation` with a `d3.forceCollide` for node spacing and a `d3.forceRadial` force that targets each node’s radius based on its type. The simulation runs over a typed array of 240 nodes, and each tick updates circle elements’ `cx` and `cy` attributes. The visualization is rendered entirely in SVG with a `viewBox` centered at the origin.
AI-generated descriptionThis example shows how to create a custom “radial” force that places nodes in a circle with a configurable radius and center. The red nodes form a circle of approximate radius 100px, and the blue nodes approximately 200px.