Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Fork of Fork of D3 Tree with Multiple Parents

Public visualization

Viewing a saved revision (read-only)

e72e02cd47f3430ba667d967c2813201

Fork of Fork of D3 Tree with Multiple Parents

0 stars1🌍 Public
AASHA
Last edited May 8, 2023
Created on May 8, 2023

This example visualizes a hierarchical tree with multiple parents, showing how nodes like "Laborer" and "Foreign worker" connect to several top-level categories. It flattens the hierarchy by deduplicating repeated nodes and manually recalculating their x- and y-positions using `_.uniq`, `_.where`, and depth-based spacing. The SVG renders horizontal links with `d3.linkHorizontal`, supports zooming via `d3.zoom`, and animates node transitions on click. Data comes from a local JSON file, and traversal uses `d3.hierarchy` and `d3.tree`. The latest top-level child is highlighted with a steel-blue stroke.

AI-generated description