Tree
Tree for a hierarchy drawn as nodes joined by elbow curves, with an optional value per node.
Use a tree to show how parts belong to the parts above them, read from left to right.
Engineering has the most teams
Each node is a part; colour is the top-level unit
EngineeringSales
This chart cannot be displayed here: it needs JavaScript and WebGL.
The same chart in each style
Source
```chart
type: tree
title: Engineering has the most teams
subtitle: Each node is a part; colour is the top-level unit
data:
inline:
- {unit: Engineering}
- {unit: Platform, reports_to: Engineering, headcount: 14}
- {unit: Product, reports_to: Engineering, headcount: 22}
- {unit: Sales}
- {unit: EMEA, reports_to: Sales, headcount: 12}
- {unit: Americas, reports_to: Sales, headcount: 16}
encoding: {label: unit, parent: reports_to, y: headcount}
```
Fields that matter
type: treewithencoding.labelfor the part name andencoding.parentfor the name of its parent- A row with no parent is a root; leaves are spaced evenly in source order and each parent sits centred over its children
encoding.yis optional and only shown in the readout; it never sizes a node, and a part with children needs none- Colour follows the top-level part, and a legend appears when there is more than one root
encoding.facetmakes one tree per value;style.ratiosets the width to height ratio
Interactions
- Hover or focus a node to read its path, its value where given and how many parts sit under it.
- Open the Table view, Download PNG or CSV, or Expand the chart.