Skip to main content
100%

Radial Force Layout

✓ Published0🌍 Public
Aakollegger
Last edited Jan 22, 2018
Created on Jan 22, 2018

This example shows a force-directed graph of the characters from *Les Misérables*, arranged in a circular layout by a radial force. Nodes are rendered as small circles and linked by gray lines, with each node carrying a title tooltip showing its name. The simulation uses d3-force’s radial force to pull nodes toward a center point at (200, 200), combined with a collision force to prevent overlaps. Using d3-drag, any node can be grabbed and moved; the dragged node is fixed to the pointer during the gesture and released when the gesture ends. The simulation is temporarily reheated during dragging by raising the alpha target, making the layout react fluidly to the user’s interaction before settling back into place.

AI-generated description

This example demonstrates applying d3-drag to a force-directed graph computed using d3-force. When the drag gesture starts, the targetted node is fixed to the pointer; it is released when the gesture ends. In addition, the simulation is temporarily “heated” during interaction by setting the target alpha to a non-zero value.

If desired, you could refine this technique by also fixing nodes on mouseover, and releasing them on mouseout. (However, if there’s an active drag gesture during mouseout, you wouldn’t want to release the node until the gesture finishes.)

Compare to the Canvas version.

forked from <a href='http://bl.ocks.org/mbostock/'>mbostock</a>'s block: <a href='http://bl.ocks.org/mbostock/2675ff61ea5e063ede2b5d63c08020c7'>Force Dragging I</a>

forked from <a href='http://bl.ocks.org/akollegger/'>akollegger</a>'s block: <a href='http://bl.ocks.org/akollegger/54c4be03e148c625217df1984e1c3908'>Force Dragging I</a>

forked from <a href='http://bl.ocks.org/akollegger/'>akollegger</a>'s block: <a href='http://bl.ocks.org/akollegger/4cc1ef18bda1281613d7793692963b45'>Single Axis Force Layout</a>

forked from <a href='http://bl.ocks.org/akollegger/'>akollegger</a>'s block: <a href='http://bl.ocks.org/akollegger/b36cee734c17d70dbeaaac8886f0d7de'>Single Axis Force Layout</a>

gpl-3.0 Licensed

Similar vizzes