Skip to main content
100%

Tree diagram using flat data with v6

✓ Published0🌍 Public
Dd3noob
Last edited Sep 13, 2020
Created on Sep 13, 2020

This example shows a hierarchical tree diagram built from flat, parent-child data. It converts the flat array into a hierarchy using `d3.stratify()`, then lays out the nodes with `d3.tree()` and renders them as SVG circles and curved links. The code assigns node names via `treeData.each()` and uses `d3.hierarchy()` to supply child relationships. Data is hardcoded in the script, and styling is set through CSS classes for internal and leaf nodes. The diagram is drawn with SVG paths and text elements.

AI-generated description

This is a tree diagram that used data from a 'flat' format.

This is designed to be used as part of documenting an update to the book D3 Tips and Tricks to version 6 of d3.js.

mit Licensed

Similar vizzes