Skip to main content
100%

D3 Location

✓ Published0🌍 Public
Rrheasue@outlook.com
Last edited Sep 11, 2024
Created on Sep 10, 2024

This example demonstrates a network diagram of interconnected nodes, where users can drag circles to reposition them and observe the linked lines update in real time. The visualization uses React for state management with a `useReducer` hook, while `d3-drag` handles the interactive dragging behavior and D3's `select` and `range` APIs render the SVG elements. Links are drawn as thick black lines connecting sequential nodes, and circles are semi-transparent with hover effects. The code initializes positions from a small dataset and dispatches drag events to update the visualization's state.

AI-generated description

A basic demonstration of d3-drag used with React to drag circles connected by lines.

This variant uses useReducer to avoid creating a new closure on each render.

Inspired by Observable: Drag (SVG).

MIT Licensed

Similar vizzes