Collapsible Tree Version 3
✓ Published5🌍 Public
This example shows a collapsible hierarchical tree of organizational roles, with nodes representing departments and positions that can be expanded or collapsed by clicking. Using D3 v4’s `d3.tree` layout and `d3.hierarchy`, the SVG renders nodes as circles and labels connected by curved diagonal paths. Clicking a node toggles its children via a `collapse` function, while transitions animate node positions, link paths, and circle sizes over 750 milliseconds. The code uses `transition.attr` and `.duration` to smoothly update the layout, with data sourced from the `treeData` object in `data.js`.
AI-generated descriptionMIT Licensed