Trend Chart

The canonical multi-series time-series chart. One configurable component that renders as line, area, or bar with a built-in mode toggle, custom tooltip, and toggleable legend. Series colour follows the multi-series hierarchy (baseline / live / context / threshold). Scroll-gated reveal.

Throughput vs plan
Requests / sec

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/andromeda-trend-chart
2

For dark mode, add the dark class to your <html> element:

Optional
<html class="dark">

Props

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

TrendSeries

PropTypeDefaultDescription
keyreqstring-Field in each data row holding this series' y-value.
labelreqstring-Display name shown in the tooltip and legend chip.
role'baseline'|'live'|'context'|'threshold'-Colour role in the Andromeda charts hierarchy; threshold also renders dashed.
colorstring-Explicit override; prefer `role`.

TrendChart

PropTypeDefaultDescription
datareqobject[]-Rows of chart data, one object per x-axis point.
seriesreqTrendSeries[]-Series to plot, each bound to a data-row field by key.
xKeystring't'Field in each data row plotted along the x-axis.
modesArray<'line'|'area'|'bar'>['area','bar']Toggle appears when >1.
defaultMode'line'|'area'|'bar'-Render mode selected on mount; defaults to the first entry in modes.
titlestring-Heading shown at the top-left of the header.
yLabelstring-Uppercase mono axis caption, top-left.
tooltipLabelFormatter(label:any)=>string-Formats the x value shown as the tooltip heading.
valueFormatter(value:any)=>string-Formats each series value shown in the tooltip.
xIntervalnumber4Number of x-axis ticks skipped between rendered labels.
showLegendbooleantrueRender the toggleable legend row in the footer.
showYAxisbooleantrueReserve the left Y-axis tick gutter. Set false on compact cards where an external headline already states the magnitude, and the plot then fills its card content box edge-to-edge with no stray left inset (the Andromeda spacing rules).
footerSlotReact.ReactNode-Right side of the footer (custom controls).
heightnumber|'fill'240Plot height in px, or 'fill' to grow into a flex parent.
classNamestring-Class applied to the root container element.
styleReact.CSSProperties-Inline styles merged onto the root container element.

More Andromeda components