Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

How to D3 Force Directed Layout Graph

Public visualization

How to D3 Force Directed Layout Graph

0 stars1🌍 Public
Iisaachowen
Last edited Aug 11, 2019
Created on Aug 11, 2019

This example demonstrates a simple force-directed network graph with three nodes connected by three links, using Game of Thrones houses as node labels. The visualization renders circles and lines in SVG and relies on `d3.forceSimulation` to compute the layout, with `linkDistance(300)` set to space the nodes apart. Node positions update on each tick event, while `force.drag` enables interactive dragging. The code builds nodes and links from a hardcoded array of source-target pairs, stored as plain JavaScript objects, and styles the elements via CSS classes.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed