Skip to main content
🌍 Public

Share visualization

Send this visualization to others.

Collapsible Tree Version 3

Public visualization

Collapsible Tree Version 3

1 star5🌍 Public
Rrainyrainyguo
Last edited Nov 24, 2020
Created on Nov 24, 2020

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 description

Comments

Sign in to join the discussion.

MIT Licensed