Skip to main content
100%

Single Axis Force Layout

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

This example shows a force-directed graph of character co-occurrence in *Les Misérables*, rendered as SVG circles connected by lines. Using d3-force and d3-drag, nodes can be grabbed and moved with the mouse; the targeted node is fixed to the pointer during the drag and released on release. The simulation is also temporarily heated by raising the alpha target during interaction, causing the graph to re-layout and settle as nodes are repositioned.

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>

gpl-3.0 Licensed

Similar vizzes