TermStructureChart
Read a market, a risk or a return, with the axis and the tooltip wired for the job.
@luc/ui/chartsWhat it shows
Compare rate or price curves across an ordered set of tenors.
Live preview
Rates already in percent units, two curves on a shared ordered tenor axis.
<TermStructureChart
tenors={["1M", "3M", "6M", "1Y", "2Y", "5Y"]}
curves={[
{
name: "Latest",
values: [4.35, 4.42, 4.51, 4.58, 4.62, 4.66],
tone: "accent",
emphasis: true,
},
{
name: "One week ago",
values: [4.72, 4.68, 4.63, 4.59, 4.55, 4.52],
tone: "neutral",
lineType: "dashed",
},
]}
yLabel="Rate"
format={{ kind: "percent", decimals: 2 }}
height={320}
ariaLabel="Rate curve"
/>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 { TermStructureChart } from "@luc/ui/charts";
<TermStructureChart
tenors={["1M", "3M", "6M", "1Y", "2Y", "5Y"]}
curves={[
{
name: "Latest",
values: [4.35, 4.42, 4.51, 4.58, 4.62, 4.66],
tone: "accent",
emphasis: true,
},
{
name: "One week ago",
values: [4.72, 4.68, 4.63, 4.59, 4.55, 4.52],
tone: "neutral",
lineType: "dashed",
},
]}
yLabel="Rate"
format={{ kind: "percent", decimals: 2 }}
height={320}
ariaLabel="Rate curve"
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 `TermStructureChart` from Luc UI. It is: Read a market, a risk or a return, with the axis and the tooltip wired for the job.
Import it with: import { TermStructureChart } 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={320}`, `state="ready"`, `ariaLabel="Rate curve"`.
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
<TermStructureChart
tenors={["1M", "3M", "6M", "1Y", "2Y", "5Y"]}
curves={[
{
name: "Latest",
values: [4.35, 4.42, 4.51, 4.58, 4.62, 4.66],
tone: "accent",
emphasis: true,
},
{
name: "One week ago",
values: [4.72, 4.68, 4.63, 4.59, 4.55, 4.52],
tone: "neutral",
lineType: "dashed",
},
]}
yLabel="Rate"
format={{ kind: "percent", decimals: 2 }}
height={320}
ariaLabel="Rate curve"
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: Financial & quantitative
import { TermStructureChart } from "@luc/ui/charts";<TermStructureChart
tenors={["1M", "3M", "6M", "1Y", "2Y", "5Y"]}
curves={[
{
name: "Latest",
values: [4.35, 4.42, 4.51, 4.58, 4.62, 4.66],
tone: "accent",
emphasis: true,
},
{
name: "One week ago",
values: [4.72, 4.68, 4.63, 4.59, 4.55, 4.52],
tone: "neutral",
lineType: "dashed",
},
]}
yLabel="Rate"
format={{ kind: "percent", decimals: 2 }}
height={320}
ariaLabel="Rate curve"
/>Data contract
`tenors` is the ordered shared x axis; every `curves[]` entry has a name and a `values` array of the same length. Values are already expressed in the chosen unit.
Important configuration
Use `yLabel` and `format` to state percent versus basis points, and distinguish curves with `emphasis` and line style rather than arbitrary colour.
Guidelines
When not to use
Do not reorder tenors for visual convenience or put curves with different quotation conventions on the same axis.
Configuration
| Export | Kind | Signature |
|---|---|---|
TermStructureChart | 21 documented props | ({ tenors, ...props }: TermStructureChartProps) => import("@types/react").JSX.Element |
TermStructureChart props
Type: TermStructureChartProps
Values the compiler reads from the declaration.
| Prop | Type | Default | Notes |
|---|---|---|---|
allowedScaleModes? | readonly YScaleMode[] | undefined | — | Which scale modes the caller may offer. Absent with no `scaleMode` keeps the chart linear-only (the historical behaviour). |
annotations? | AnnotationSpec | undefined | — | |
ariaDescription? | string | undefined | — | |
ariaLabel? | string | undefined | — | |
className? | string | undefined | — | |
curves | readonly CurveDefinition[] | — | |
description? | string | undefined | — | |
format? | ChartFormat | undefined | — | |
height? | string | number | undefined | — | |
interaction? | ChartInteractionSpec | undefined | — | |
onEvent? | ((event: EChartEvent) => void) | undefined | — | |
onReady? | ((chart: EChartsInstance) => void) | undefined | — | |
scaleMode? | YScaleMode | undefined | — | The **presentation** scale of the shared y axis. A multi-cycle indexed price path, a growth curve and a long-horizon price model are read across orders of magnitude, where a linea… |
state? | ChartState | undefined | — | |
syncGroup? | string | undefined | — | |
tenors | readonly (string | number)[] | — | Tenors: years, month counts or expiry labels. Sorted ascending internally. |
title? | string | undefined | — | |
visibleSeries? | readonly string[] | undefined | — | |
xFormat? | ChartFormat | undefined | — | The format of a **numeric** x axis, when it is not the value format. A term structure's tenor is a count of years and a cycle path's x is a count of days: both are numbers, and ne… |
xLabel? | string | undefined | — | |
yLabel? | 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
Financial & quantitative
Presentation only: not one metric here is computed by the library.
Related