Skip to main content
Public

Share visualization

Loading preview…

Collapsible Tree Version 3

vizhub.com

Shared links may look like this on X, LinkedIn, Slack, and Discord.

Before sharing, review the publishing checklist.

Choose how to deliver this visualization

LinkedIn caption

LinkedIn may not keep text supplied by the share sheet. Copy the caption and paste it into the post if needed. You can tag the VizHub company page when posting.

More options

Embed on a websiteCopy iframe embed code
Download & exportPNG, HTML, source ZIP

Collapsible Tree Version 3

4
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