Data Answer ChartPRO
An assistant answer that draws its chart as the table streams in: bars or a line that grow row by row, with a Bar/Line morph and a hover tooltip.
Code
2 files · 486 lines of TypeScriptPRO
Data Answer Chart is part of Pro
Get its source, the one-paste agent prompt and all 113 components, for a one-time $99.
Motion notes
- Each row grows up from the baseline as it arrives. Slots for expected rows are reserved, so earlier bars never reflow while the stream is running.
- Bar and Line are one shape per value written with the same path commands: bars shrink into dots on a layout spring, then the line draws through them. Going back undraws the line first.
- When a new row raises the maximum, the y ticks glide to their new positions and the bars rescale with them, so the scale change reads as continuous.
- Monochrome on purpose: one emphasized series in the primary ink, the rest in muted steps, plus a legend so identity never depends on brightness alone. Arrow keys read values and a screen-reader table carries the same data. With reduced motion, shapes snap.
Usage
Example
<DataChart
title="Monthly active users"
series={[{ key: "2026", label: "2026" }, { key: "2025", label: "2025" }]}
rows={rowsSoFar}
expectedRows={12}
streaming={!done}
caption="Up 3.5× since January."
/>Props
| Prop | Type | Default | Description |
|---|---|---|---|
| rows | ChartRow[] | — | { label, values: number[] }: rows received so far, values in series order. Append as the table streams. |
| series | ChartSeries[] | — | { key, label } for each value column. |
| emphasis | string | series[0].key | Key of the series drawn in --text-primary. |
| expectedRows | number | 0 | Reserve slots for this many rows, so bars don't reflow as rows arrive. |
| type | "bar" | "line" | — | Controlled chart type. Leave it out for uncontrolled use. |
| defaultType | "bar" | "line" | "bar" | Initial chart type. |
| onTypeChange | (type: ChartType) => void | — | Called when the Bar/Line toggle changes. |
| activeIndex | number | null | — | Controlled hovered or focused row. |
| onActiveIndexChange | (index: number | null) => void | — | Called on hover, arrow keys and leave. |
| streaming | boolean | false | Rows are still arriving: shows a reading label and holds the caption back. |
| title | ReactNode | — | Chart heading. |
| caption | ReactNode | — | The answer in words, shown once streaming ends. |
| format | (value: number) => string | compact (12.4K) | Formats ticks, tooltips and table values. |
| height | number | 200 | Chart height in px, axes included. |
| className | string | — | Classes for the figure. |