Skip to content
Financial & quantitativeGenerated from the public API

CurveComparisonChart

Read a market, a risk or a return, with the axis and the tooltip wired for the job.

@luc/ui/charts

What it shows

Compare several curves over one ordered numeric x domain, such as implied volatility across strikes or expiries.

Live preview

Implied volatility in percent against strike: the smile shape is the market's, never interpolated here.

<CurveComparisonChart
  xLabels={[90, 95, 100, 105, 110]}
  curves={[
    {
      name: "One month",
      tone: "accent",
      emphasis: true,
      values: [24.1, 20.4, 18.6, 19.2, 21.8],
    },
    { name: "Three months", tone: "neutral", values: [22.4, 19.6, 18.1, 18.9, 20.7] },
  ]}
  xLabel="Strike"
  yLabel="Implied volatility"
  format={{ kind: "percent", decimals: 1 }}
  height={320}
  ariaLabel="Smile by expiry"
/>

Controls

Height

320px

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 { CurveComparisonChart } from "@luc/ui/charts";

<CurveComparisonChart
  xLabels={[90, 95, 100, 105, 110]}
  curves={[
    {
      name: "One month",
      tone: "accent",
      emphasis: true,
      values: [24.1, 20.4, 18.6, 19.2, 21.8],
    },
    { name: "Three months", tone: "neutral", values: [22.4, 19.6, 18.1, 18.9, 20.7] },
  ]}
  xLabel="Strike"
  yLabel="Implied volatility"
  format={{ kind: "percent", decimals: 1 }}
  height={320}
  ariaLabel="Smile by expiry"
  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 `CurveComparisonChart` 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 { CurveComparisonChart } 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="Smile by expiry"`.

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
<CurveComparisonChart
  xLabels={[90, 95, 100, 105, 110]}
  curves={[
    {
      name: "One month",
      tone: "accent",
      emphasis: true,
      values: [24.1, 20.4, 18.6, 19.2, 21.8],
    },
    { name: "Three months", tone: "neutral", values: [22.4, 19.6, 18.1, 18.9, 20.7] },
  ]}
  xLabel="Strike"
  yLabel="Implied volatility"
  format={{ kind: "percent", decimals: 1 }}
  height={320}
  ariaLabel="Smile by expiry"
  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 { CurveComparisonChart } from "@luc/ui/charts";
<CurveComparisonChart
  xLabels={[90, 95, 100, 105, 110]}
  curves={[
    {
      name: "One month",
      tone: "accent",
      emphasis: true,
      values: [24.1, 20.4, 18.6, 19.2, 21.8],
    },
    { name: "Three months", tone: "neutral", values: [22.4, 19.6, 18.1, 18.9, 20.7] },
  ]}
  xLabel="Strike"
  yLabel="Implied volatility"
  format={{ kind: "percent", decimals: 1 }}
  height={320}
  ariaLabel="Smile by expiry"
/>

Data contract

`xLabels` defines the shared ordered x values; each `curves[]` entry supplies a name and a `values` array of equal length. The chart draws the supplied points without interpolation.

Important configuration

Set `xLabel`, `yLabel` and `format`, and use `emphasis` for the curve the reader should inspect first.

Guidelines

When not to use

Do not read values between supplied strikes as if the line were an interpolated model; the connecting geometry is not new data.

Configuration

Exported symbols
ExportKindSignature
CurveComparisonChart21 documented props({ xLabels, curves, xLabel, yLabel, format, xFormat, annotations, interaction, syncGroup, visibleSeries, scaleMode, allowedScaleModes, title, description, state, height, className, ariaLabel, ariaDes…

CurveComparisonChart props

Type: CurveComparisonChartProps

Values the compiler reads from the declaration.

CurveComparisonChart props
PropTypeDefaultNotes
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—
curvesreadonly 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—
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—
xLabelsreadonly (string | number)[]—
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.

Luc UI v1.0CurveComparisonChartdark theme