Chart Metric

Charts one measurement over time in a panel that frames itself.

/// APIResponse time

Variants

Supported configurations for this component.

Variants

2 examples
Neutral
/// APIResponse time
Tone from data
/// APIResponse time
Live

Add to your project

One command adds this component to your project.

1

Run the following command. New project? Run npx shadcn@latest init first to set up Tailwind and path aliases.

npx shadcn@latest add @aicanvas/••••••••••••

Light and dark both come with the install and follow the dark class on <html>, the shadcn dark mode setup (next-themes with attribute="class").

Props

Every prop this component accepts. Any other prop is forwarded to the underlying element.

PropTypeDefaultDescription
labelstring'/// Telemetry'Card kicker label.
titlestring'Metric'Card title.
descriptionstring-Optional description line.
dataobject[]-Points of { [xKey], [dataKey] }.
dataKeystring'v'-
xKeystring't'-
unitstring-Shown muted after the tooltip value.
thresholds{warning: number, fault: number}-Where this metric stops being healthy, in `dataKey` units. Supply it and the panel colours itself from the LATEST reading — the preferred form, since a chart that is TOLD its colour can contradict the series it draws. The order carries the direction: `{warning: 70, fault: 90}` is high-is-bad, `{warning: 30, fault: 15}` is low-is-bad. Boundaries are inclusive.
variant'neutral'|'accent'|'warning'|'fault''accent'Sets the badge tone, and decides whether the series reads as declared (the live stop) or as stated-by-nothing (`neutral`, the grey single-series ink every other chart uses). The manual fallback, for a metric with no meaningful threshold; `thresholds` wins.
badgeTextstring|null'Live'null hides the badge.
domain[number|string, number|string]['dataMin - 1', 'dataMax + 1']recharts y-domain (fitted).
xIntervalnumber|'preserveStart'|'preserveEnd'|'preserveStartEnd''preserveStartEnd'Tick thinning. 'preserveStartEnd' (default) picks an index-even spread of ~7 labels that always includes the first and last reading. A number shows every nth label (recharts native); 'preserveStart'/'preserveEnd' also fall through to recharts native.
heightnumber|'fill'224Plot height; 'fill' grows into a flex parent.
classNamestring-Additional CSS classes applied to the root element.
styleReact.CSSProperties-Inline styles applied to the root element.

More Andromeda Pro components