DendrogramChart
Follow the relationship rather than the value — hover a mark to read its row.
@luc/ui/chartsWhat it shows
Show the merge order and distance structure of a hierarchical clustering computed upstream.
Live preview
Merge heights supplied in increasing order: the clustering happened upstream, LUC draws the tree.
<DendrogramChart
leaves={["EQ", "HY", "IG", "GOLD", "OIL", "FX", "REIT", "TECH"]}
merges={[
{ id: "m1", left: "HY", right: "IG", height: 0.24 },
{ id: "m2", left: "EQ", right: "TECH", height: 0.31 },
{ id: "m3", left: "m1", right: "m2", height: 0.46 },
{ id: "m4", left: "GOLD", right: "OIL", height: 0.38 },
{ id: "m5", left: "m4", right: "m3", height: 0.62 },
{ id: "m6", left: "FX", right: "REIT", height: 0.55 },
{ id: "m7", left: "m6", right: "m5", height: 0.81 },
]}
format={{ kind: "decimal", decimals: 2 }}
height={340}
ariaLabel="Clustering of eight assets"
/>Controls
Height
A chart measures its container, so it always needs a definite height.
State
The surface the chart is in — loading, empty and error are drawn by the component.
Accessible name
A drawing is not readable by a screen reader, so it needs a name that states what it shows.
The same fixture as the live preview above; the controls change how it is drawn, not what it measures.
Code
import { DendrogramChart } from "@luc/ui/charts";
<DendrogramChart
leaves={["EQ", "HY", "IG", "GOLD", "OIL", "FX", "REIT", "TECH"]}
merges={[
{ id: "m1", left: "HY", right: "IG", height: 0.24 },
{ id: "m2", left: "EQ", right: "TECH", height: 0.31 },
{ id: "m3", left: "m1", right: "m2", height: 0.46 },
{ id: "m4", left: "GOLD", right: "OIL", height: 0.38 },
{ id: "m5", left: "m4", right: "m3", height: 0.62 },
{ id: "m6", left: "FX", right: "REIT", height: 0.55 },
{ id: "m7", left: "m6", right: "m5", height: 0.81 },
]}
format={{ kind: "decimal", decimals: 2 }}
height={340}
ariaLabel="Clustering of eight assets"
state="ready"
/>Not controllable here
series / rows— The numbers are the caller's; the fixture above is the example.
Copy for an AI agentA specification an agent can act on: the import, the setup, the chosen props, the data contract and the accessibility expectation.
Implement `DendrogramChart` from Luc UI. It is: Follow the relationship rather than the value — hover a mark to read its row.
Import it with: import { DendrogramChart } from "@luc/ui/charts";
Requires: react ^19.0.0; react-dom ^19.0.0; react-hook-form ^7.0.0 (optional, for @luc/ui/forms/react-hook-form); tailwindcss ^4.0.0; node >= 22 (repository tools). Import the stylesheet once at the app root and wrap the tree in `LucProvider`. Both come from the package that publishes @luc.
Chosen configuration: `height={340}`, `state="ready"`, `ariaLabel="Clustering of eight assets"`.
Accessibility: keep the component's own semantics. Do not re-implement its ARIA wiring, do not add roles it does not declare, and make sure every interactive element is reachable and operable from the keyboard with a visible focus state.
Styling: use Luc UI design tokens and the component's own props. Do not restyle with raw colour literals and do not override the component's internal structure with page CSS.
Motion: respect `prefers-reduced-motion`. The component already does, so do not disable it.
Reproduce this state:
```tsx
<DendrogramChart
leaves={["EQ", "HY", "IG", "GOLD", "OIL", "FX", "REIT", "TECH"]}
merges={[
{ id: "m1", left: "HY", right: "IG", height: 0.24 },
{ id: "m2", left: "EQ", right: "TECH", height: 0.31 },
{ id: "m3", left: "m1", right: "m2", height: 0.46 },
{ id: "m4", left: "GOLD", right: "OIL", height: 0.38 },
{ id: "m5", left: "m4", right: "m3", height: 0.62 },
{ id: "m6", left: "FX", right: "REIT", height: 0.55 },
{ id: "m7", left: "m6", right: "m5", height: 0.81 },
]}
format={{ kind: "decimal", decimals: 2 }}
height={340}
ariaLabel="Clustering of eight assets"
state="ready"
/>
```Usage
The values are prepared by the caller: this component draws the points it is given and computes no statistic of its own, so units, scaling and any summary have to be settled before the data reaches it.
It is drawn by the ECharts engine.
Worked examples with real data are on the family overview: Multidimensional, network & hierarchy
import { DendrogramChart } from "@luc/ui/charts";<DendrogramChart
leaves={["EQ", "HY", "IG", "GOLD", "OIL", "FX", "REIT", "TECH"]}
merges={[
{ id: "m1", left: "HY", right: "IG", height: 0.24 },
{ id: "m2", left: "EQ", right: "TECH", height: 0.31 },
{ id: "m3", left: "m1", right: "m2", height: 0.46 },
{ id: "m4", left: "GOLD", right: "OIL", height: 0.38 },
{ id: "m5", left: "m4", right: "m3", height: 0.62 },
{ id: "m6", left: "FX", right: "REIT", height: 0.55 },
{ id: "m7", left: "m6", right: "m5", height: 0.81 },
]}
format={{ kind: "decimal", decimals: 2 }}
height={340}
ariaLabel="Clustering of eight assets"
/>Data contract
`leaves` names the terminal items; each `merge` has an id, left/right child ids and a numeric `height`. Merge heights must come from the clustering and listen in increasing order.
Important configuration
Keep the leaf order and merge ids stable, format the height with `format`, and state the distance metric and linkage in the caption.
Guidelines
When not to use
Do not use the branch lengths to imply a clustering method the upstream process did not use, or reorder leaves without preserving the merge tree.
Configuration
| Export | Kind | Signature |
|---|---|---|
DendrogramChart | 13 documented props | ({ leaves, merges, format, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: DendrogramChartProps) => import("@types/react").JSX.Element |
DendrogramChart props
Type: DendrogramChartProps
Values the compiler reads from the declaration.
| Prop | Type | Default | Notes |
|---|---|---|---|
ariaDescription? | string | undefined | — | |
ariaLabel? | string | undefined | — | |
className? | string | undefined | — | |
description? | string | undefined | — | |
eager? | boolean | undefined | — | Create the engine on mount rather than when the surface is approached. |
format? | ChartFormat | undefined | — | |
height? | string | number | undefined | — | |
leaves | readonly string[] | — | Leaf labels, left to right. |
merges | readonly DendrogramMerge[] | — | Merges in increasing height order, as the caller's own clustering produced them. |
onEvent? | ((event: EChartEvent) => void) | undefined | — | |
onReady? | ((chart: EChartsInstance) => void) | undefined | — | |
state? | ChartState | undefined | — | |
title? | string | undefined | — |
Accessibility
A chart is a picture of data, so it needs a name that states what it shows, and the numbers must exist as text somewhere on the page — in a table or a written summary — because a drawing is not readable by a screen reader and cannot be copied.
What happens on the server, and when hydration changes it.
Family
Multidimensional, network & hierarchy
When the relationship, not the value, is the finding.
Related