Skip to main content
100%

Collapsible Tree Example

✓ Published0🌍 Public
Dd3noob
Last edited Nov 30, 2019
Created on Jan 28, 2017

This example shows a collapsible tree diagram with a horizontal orientation, displaying hierarchical data with parent and child nodes connected by curved links. The tree layout is computed using `d3.layout.tree`, and links are drawn as SVG paths using `d3.svg.diagonal` with a custom projection that swaps x and y coordinates to achieve the horizontal layout. Nodes are rendered as circles with text labels, and the code uses D3 version 3.5.17, loading the library from a CDN. The data is hardcoded as a JavaScript array with nested objects representing the tree structure.

AI-generated description

Test code for a tree diagram with the diagonal variable edited to allow for placement of the relative positions of the links to be altered. However the direction that the links head is vertically, but the orientation of the tree is desired to be horizontally.

forked from <a href='http://bl.ocks.org/d3noob/'>d3noob</a>'s block: <a href='http://bl.ocks.org/d3noob/8323795'>Simple d3.js tree diagram</a>

mit Licensed

Similar vizzes