Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of D3 Tree with Multiple Parents

Public visualization

Fork of D3 Tree with Multiple Parents

0 stars0🌍 Public
UUSWS-FR
Last edited Sep 30, 2023
Created on Sep 30, 2023

This example adapts D3’s hierarchical tree layout to visualize a directed graph with multiple parents, showing how shared child nodes like “Supply and demand” branch from two distinct roots. It uses `d3.tree`, `d3.hierarchy`, and `d3.linkHorizontal` to compute positions, then deduplicates nodes with underscore.js and manually recalculates x/y coordinates to handle overlapping descendants. SVG paths and text elements render the links and labels, with `d3.zoom` enabling pan and zoom. The source data is a small JSON array of government and market concepts, and the view animates between states using D3 transitions.

AI-generated description

Comments

Sign in to join the discussion.

MIT Licensed