FeatureImportanceChart
Check whether a model or a process is sane, from values you computed.
@luc/ui/chartsWhat it shows
Rank features by a supplied importance or coefficient together with its uncertainty.
Live preview
Ranked importances with the caller's own standard errors; signed, because these are coefficients.
<FeatureImportanceChart
features={[
{ key: "vol", label: "Realised vol", value: 0.31, low: 0.26, high: 0.36 },
{ key: "carry", label: "Carry", value: 0.24, low: 0.2, high: 0.28 },
{ key: "trend", label: "Trend", value: 0.18, low: 0.14, high: 0.22 },
{ key: "value", label: "Value", value: 0.11, low: 0.07, high: 0.15 },
{ key: "size", label: "Size", value: -0.07, low: -0.12, high: -0.02 },
]}
intervalLabel="±1 s.e."
signed
format={{ kind: "number", decimals: 2, signed: true }}
height={320}
ariaLabel="Feature importance"
/>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 { FeatureImportanceChart } from "@luc/ui/charts";
<FeatureImportanceChart
features={[
{ key: "vol", label: "Realised vol", value: 0.31, low: 0.26, high: 0.36 },
{ key: "carry", label: "Carry", value: 0.24, low: 0.2, high: 0.28 },
{ key: "trend", label: "Trend", value: 0.18, low: 0.14, high: 0.22 },
{ key: "value", label: "Value", value: 0.11, low: 0.07, high: 0.15 },
{ key: "size", label: "Size", value: -0.07, low: -0.12, high: -0.02 },
]}
intervalLabel="±1 s.e."
signed
format={{ kind: "number", decimals: 2, signed: true }}
height={320}
ariaLabel="Feature importance"
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 `FeatureImportanceChart` from Luc UI. It is: Check whether a model or a process is sane, from values you computed.
Import it with: import { FeatureImportanceChart } 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="Feature importance"`.
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
<FeatureImportanceChart
features={[
{ key: "vol", label: "Realised vol", value: 0.31, low: 0.26, high: 0.36 },
{ key: "carry", label: "Carry", value: 0.24, low: 0.2, high: 0.28 },
{ key: "trend", label: "Trend", value: 0.18, low: 0.14, high: 0.22 },
{ key: "value", label: "Value", value: 0.11, low: 0.07, high: 0.15 },
{ key: "size", label: "Size", value: -0.07, low: -0.12, high: -0.02 },
]}
intervalLabel="±1 s.e."
signed
format={{ kind: "number", decimals: 2, signed: true }}
height={320}
ariaLabel="Feature importance"
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: Diagnostics, ML & risk
import { FeatureImportanceChart } from "@luc/ui/charts";<FeatureImportanceChart
features={[
{ key: "vol", label: "Realised vol", value: 0.31, low: 0.26, high: 0.36 },
{ key: "carry", label: "Carry", value: 0.24, low: 0.2, high: 0.28 },
{ key: "trend", label: "Trend", value: 0.18, low: 0.14, high: 0.22 },
{ key: "value", label: "Value", value: 0.11, low: 0.07, high: 0.15 },
{ key: "size", label: "Size", value: -0.07, low: -0.12, high: -0.02 },
]}
intervalLabel="±1 s.e."
signed
format={{ kind: "number", decimals: 2, signed: true }}
height={320}
ariaLabel="Feature importance"
/>Data contract
`features` contain `key`, `label`, `value` and optional `low`/`high` bounds; `signed` determines whether zero is a meaningful centre. The importances come from the model.
Important configuration
Set `signed` when coefficients can be negative, name the interval with `intervalLabel`, and format the value consistently across features.
Guidelines
When not to use
Do not present a model-specific importance as a universal causal ranking or drop the uncertainty interval when it is available.
Configuration
| Export | Kind | Signature |
|---|---|---|
FeatureImportanceChart | 14 documented props | ({ features, format, intervalLabel, signed, title, description, state, height, className, ariaLabel, ariaDescription, onReady, onEvent, eager, }: FeatureImportanceChartProps) => import("@types/react"… |
FeatureImportanceChart props
Type: FeatureImportanceChartProps
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. |
features | readonly FeatureImportance[] | — | |
format? | ChartFormat | undefined | — | |
height? | string | number | undefined | — | |
intervalLabel? | string | undefined | — | Name of the interval, e.g. "±1 s.e." or "90% CI". |
onEvent? | ((event: EChartEvent) => void) | undefined | — | |
onReady? | ((chart: EChartsInstance) => void) | undefined | — | |
signed? | boolean | undefined | — | Draw positive values in the positive tone and negative in the negative tone. |
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
Diagnostics, ML & risk
The figures that answer “is this sane?” — all from values the caller computed.
Related