TernaryChart
Read a field, a geometry or a spectrum, with the scale handled for you.
@luc/ui/chartsWhat it shows
Show three-part compositions in which each observation's shares are intended to sum to one.
Live preview
Each point's three shares sum to one, which is the only thing the geometry can honestly accept.
<TernaryChart
points={[
{ a: 0.8, b: 0.1, c: 0.1, label: "A" },
{ a: 0.6, b: 0.3, c: 0.1, label: "B" },
{ a: 0.55, b: 0.25, c: 0.2, label: "C" },
{ a: 0.33, b: 0.33, c: 0.34, label: "D" },
{ a: 0.2, b: 0.5, c: 0.3, label: "E" },
{ a: 0.1, b: 0.2, c: 0.7, label: "F" },
]}
corners={["Growth", "Value", "Quality"]}
format={{ kind: "percent", decimals: 0 }}
height={360}
ariaLabel="Style mix"
/>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 { TernaryChart } from "@luc/ui/charts";
<TernaryChart
points={[
{ a: 0.8, b: 0.1, c: 0.1, label: "A" },
{ a: 0.6, b: 0.3, c: 0.1, label: "B" },
{ a: 0.55, b: 0.25, c: 0.2, label: "C" },
{ a: 0.33, b: 0.33, c: 0.34, label: "D" },
{ a: 0.2, b: 0.5, c: 0.3, label: "E" },
{ a: 0.1, b: 0.2, c: 0.7, label: "F" },
]}
corners={["Growth", "Value", "Quality"]}
format={{ kind: "percent", decimals: 0 }}
height={360}
ariaLabel="Style mix"
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 `TernaryChart` from Luc UI. It is: Read a field, a geometry or a spectrum, with the scale handled for you.
Import it with: import { TernaryChart } 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={360}`, `state="ready"`, `ariaLabel="Style mix"`.
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
<TernaryChart
points={[
{ a: 0.8, b: 0.1, c: 0.1, label: "A" },
{ a: 0.6, b: 0.3, c: 0.1, label: "B" },
{ a: 0.55, b: 0.25, c: 0.2, label: "C" },
{ a: 0.33, b: 0.33, c: 0.34, label: "D" },
{ a: 0.2, b: 0.5, c: 0.3, label: "E" },
{ a: 0.1, b: 0.2, c: 0.7, label: "F" },
]}
corners={["Growth", "Value", "Quality"]}
format={{ kind: "percent", decimals: 0 }}
height={360}
ariaLabel="Style mix"
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: Scientific & mathematical
import { TernaryChart } from "@luc/ui/charts";<TernaryChart
points={[
{ a: 0.8, b: 0.1, c: 0.1, label: "A" },
{ a: 0.6, b: 0.3, c: 0.1, label: "B" },
{ a: 0.55, b: 0.25, c: 0.2, label: "C" },
{ a: 0.33, b: 0.33, c: 0.34, label: "D" },
{ a: 0.2, b: 0.5, c: 0.3, label: "E" },
{ a: 0.1, b: 0.2, c: 0.7, label: "F" },
]}
corners={["Growth", "Value", "Quality"]}
format={{ kind: "percent", decimals: 0 }}
height={360}
ariaLabel="Style mix"
/>Data contract
Each `point` supplies `a`, `b` and `c` shares plus an optional label; `corners` names the three vertices. Non-unit totals are normalised for placement and shown as supplied in the tooltip.
Important configuration
Name all three corners, keep `grid` on when values need interpolation cues, and use `format` for the share convention.
Guidelines
When not to use
Do not use a ternary plot for components that are not parts of one whole or for negative shares.
Configuration
| Export | Kind | Signature |
|---|---|---|
TernaryChart | 14 documented props | ({ points, corners, grid, format, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: TernaryChartProps) => import("@types/react").JSX.Element |
TernaryChart props
Type: TernaryChartProps
Values the compiler reads from the declaration.
| Prop | Type | Default | Notes |
|---|---|---|---|
ariaDescription? | string | undefined | — | |
ariaLabel? | string | undefined | — | |
className? | string | undefined | — | |
corners? | readonly [string, string, string] | undefined | — | Vertex labels, anticlockwise from the top. |
description? | string | undefined | — | |
eager? | boolean | undefined | — | Create the engine on mount rather than when the surface is approached. |
format? | ChartFormat | undefined | — | |
grid? | boolean | undefined | — | Draw the 10% grid. Default `true`. |
height? | string | number | undefined | — | |
onEvent? | ((event: EChartEvent) => void) | undefined | — | |
onReady? | ((chart: EChartsInstance) => void) | undefined | — | |
points | readonly TernaryPoint[] | — | |
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
Scientific & mathematical
Fields, geometry and spectra for scientific readers.
Related