Search⌘ K
AI Features

Generating a Tree Diagram from 'Flat' Data

Explore how to transform flat data into hierarchical structures with the d3.stratify function in D3.js. This lesson helps you create tree diagrams from non-hierarchical data by defining unique node identifiers and parent relationships, enabling more flexible and interactive visualizations.

We'll cover the following...

Tree diagrams are a fantastic way of displaying information. But one of the drawbacks (to the examples we’ve been using so far) is the need to have your data encoded hierarchically.

Flat data

Most data in a raw form will be flat. That is to say, it won’t be formatted as an array with the parent-child ...