CorrelationMatrix
See the distribution, the agreement or the uncertainty in the values you supply.
@luc/ui/chartsWhat it shows
Reveal clusters and signs of pairwise linear relationships across several variables.
Live preview
Symmetric coefficients in −1…1 with a unit diagonal; the matrix arrives already computed.
<CorrelationMatrix
labels={["Equity", "Credit", "Rates", "Gold", "Oil"]}
values={[
[1, 0.72, -0.34, 0.11, 0.46],
[0.72, 1, -0.18, 0.05, 0.38],
[-0.34, -0.18, 1, 0.29, -0.22],
[0.11, 0.05, 0.29, 1, 0.17],
[0.46, 0.38, -0.22, 0.17, 1],
]}
height={340}
ariaLabel="Correlation across 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 { CorrelationMatrix } from "@luc/ui/charts";
<CorrelationMatrix
labels={["Equity", "Credit", "Rates", "Gold", "Oil"]}
values={[
[1, 0.72, -0.34, 0.11, 0.46],
[0.72, 1, -0.18, 0.05, 0.38],
[-0.34, -0.18, 1, 0.29, -0.22],
[0.11, 0.05, 0.29, 1, 0.17],
[0.46, 0.38, -0.22, 0.17, 1],
]}
height={340}
ariaLabel="Correlation across 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 `CorrelationMatrix` from Luc UI. It is: See the distribution, the agreement or the uncertainty in the values you supply.
Import it with: import { CorrelationMatrix } 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="Correlation across 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
<CorrelationMatrix
labels={["Equity", "Credit", "Rates", "Gold", "Oil"]}
values={[
[1, 0.72, -0.34, 0.11, 0.46],
[0.72, 1, -0.18, 0.05, 0.38],
[-0.34, -0.18, 1, 0.29, -0.22],
[0.11, 0.05, 0.29, 1, 0.17],
[0.46, 0.38, -0.22, 0.17, 1],
]}
height={340}
ariaLabel="Correlation across 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: Statistical
import { CorrelationMatrix } from "@luc/ui/charts";<CorrelationMatrix
labels={["Equity", "Credit", "Rates", "Gold", "Oil"]}
values={[
[1, 0.72, -0.34, 0.11, 0.46],
[0.72, 1, -0.18, 0.05, 0.38],
[-0.34, -0.18, 1, 0.29, -0.22],
[0.11, 0.05, 0.29, 1, 0.17],
[0.46, 0.38, -0.22, 0.17, 1],
]}
height={340}
ariaLabel="Correlation across assets"
/>Data contract
`labels` names the variables; `values` is a square symmetric matrix with a unit diagonal. Coefficients must already be computed and lie in the supported −1…1 domain.
Important configuration
Use `labelMode` to control coefficient labels on dense grids, and `formatValue` when the caller needs a different coefficient precision.
Guidelines
When not to use
Do not present correlation as causation, and do not feed a non-symmetric matrix into a chart whose cells imply an unordered pair.
Configuration
| Export | Kind | Signature |
|---|---|---|
CorrelationMatrix | 15 documented props | ({ labels, values, title, description, labelMode, showValues, formatValue, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: CorrelationMatrixProps) => import("@types/… |
CorrelationMatrix props
Type: CorrelationMatrixProps
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. |
formatValue? | ((value: number) => string) | undefined | — | Formats a printed coefficient. Default: two decimals with the sign kept (`1.00`, `0.78`, `-0.42`). The diagonal is printed as `1.00`. |
height? | string | number | undefined | — | |
labelMode? | MatrixLabelMode | undefined | — | When to print the coefficient inside each cell. `"auto"` (the default) decides per *rendered cell*, not per row count: the values appear when a cell is at least 44×18 CSS px and d… |
labels | readonly string[] | — | |
onEvent? | ((event: EChartEvent) => void) | undefined | — | |
onReady? | ((chart: EChartsInstance) => void) | undefined | — | |
showValues? | boolean | undefined | — | |
state? | ChartState | undefined | — | |
title? | string | undefined | — | |
values | readonly (readonly number[])[] | — | Square matrix, `values[row][col]`, already computed by the caller. |
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
Statistical
Distributions, agreement and uncertainty — all from prepared values.
Related