Skip to main content
100%

Fork of Fork of D3 Tree with Multiple Parents

✓ Published1🌍 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
MIT Licensed

Similar vizzes