registry
@automindzsheets 01–77shadcn 4.x
SHEET 13

Chart Card

block / data / chart

Line, area, bar and donut charts in a card, drawn as inline SVG with honest axes, one hover readout and every state. No chart library.

type
block
files
2
registry deps
button, card, skeleton, @automindz/empty-state
npm deps
lucide-react

installs

  • lib/automindz/charts.ts
  • components/automindz/chart-card.tsx
  • Line, area, bar, stacked, grouped and donut — all inline SVG
  • Nice-number axes; bars and areas never leave the zero baseline
  • One hover readout for the whole chart, and the numbers in a hidden table

One data shape for every form: categories plus series[].values running parallel to it, where null is a gap and not a zero. Pick form: line, area, bar (with stacked or orientation="horizontal") or donut. A Date category formats itself for the span the axis shows. A single number is not a chart — pass value and delta with no data. data={undefined} renders the skeleton, an empty series the empty state, and error the failure with an awaited onRetry.

Variations

one state per section

01

Trend over time, three accounts

Sweep across the plot with a pointer: the crosshair snaps to the nearest real month — never to the pointer's own position — and one readout lists **every** series at that month, so you never have to land on a line. Exactly one readout can exist, because "which category is open" is a single piece of state, and it is only mounted while something is active — nothing can be stranded by an exit animation that never ran. Twelve months across a year boundary, so the axis labels format as month-and-year rather than repeating the day.

fluid
Monthly recurring revenue
Top three accounts, last twelve months
$37.2k+6.4%vs last month
Monthly recurring revenue. Top three accounts, last twelve months
PeriodLumen Retail (MRR)Hyreflow (MRR)Meridian Health (MRR)
Sep 1, 2025$11.5k$7.9k$7.5k
Oct 1, 2025$11.7k$8.7k$7.3k
Nov 1, 2025$11.6k$9.3k$7.5k
Dec 1, 2025$11.9k$9.6k$8k
Jan 1, 2026$12.7k$9.6k$8.3k
Feb 1, 2026$13.5k$10k$8.2k
Mar 1, 2026$13.5k$10.9k$8.1k
Apr 1, 2026$13.4k$11.5k$8.3k
May 1, 2026$13.8k$11.6k$8.9k
Jun 1, 2026$14.8k$11.6k$9.1k
Jul 1, 2026$15.4k$12.1k$9k
Aug 1, 2026$15.4k$13.1k$8.8k
Excludes one-off professional services.
02

One series, volume is the point

form="area" for a single series where the area under the line means something. The wash is the series hue at 10%, never a saturated block, and the axis includes zero — an area chart with a truncated baseline draws a shape whose size is a lie. Thirty daily buckets, so the axis prints day-and-month and thins the labels to the ones that fit; every date is still in the hidden table in full.

fluid
API calls
All workspaces, July 2026
21,400+12.8%vs June
API calls. All workspaces, July 2026
PeriodAPI calls (calls)
Jul 1, 202613.9K
Jul 2, 202614K
Jul 3, 202614.8K
Jul 4, 202615.5K
Jul 5, 202615.4K
Jul 6, 202615K
Jul 7, 202615.3K
Jul 8, 202616.2K
Jul 9, 202616.7K
Jul 10, 202616.5K
Jul 11, 202616.1K
Jul 12, 202616.6K
Jul 13, 202617.5K
Jul 14, 202618K
Jul 15, 202617.6K
Jul 16, 202617.3K
Jul 17, 202617.9K
Jul 18, 202618.9K
Jul 19, 202619.2K
Jul 20, 202618.7K
Jul 21, 202618.5K
Jul 22, 202619.3K
Jul 23, 202620.3K
Jul 24, 202620.4K
Jul 25, 202619.8K
Jul 26, 202619.7K
Jul 27, 202620.7K
Jul 28, 202621.6K
Jul 29, 202621.5K
Jul 30, 202620.9K
03

Categorical comparison, values on the cap

One bar per client, from a zero baseline — a bar encodes length, so a truncated axis misstates the ratio between two of them. Marks cap at 24px however wide the card gets, with the data end rounded and the baseline end square, and the value rides the cap because seven of them fit. Hover anywhere in a bar's slot: the whole band is the hit target, not just the painted pixels.

fluid
Spend by client
This month, largest first
Spend by client. This month, largest first
ClientMonthly spend (per month)
Lumen$15.3k
Hyreflow$12.8k
Meridian$9.2k
Solstice$8.5k
Orchard$5.6k
Northwind$4.9k
Bright Harbour$4.1k
04

Part-to-whole over time

stacked turns the same bar into a part-to-whole. Segments are separated by a 2px gap in the card's own colour — never a border drawn around the mark — and the axis measures the column total rather than the tallest tier. The legend prints each tier's total for the whole range.

fluid
Revenue by plan
Four quarters, all tiers
$74.9k+18.2%vs Q1
Revenue by plan. Four quarters, all tiers
QuarterStarterGrowthScale
Q3 2025$3.1k$18.2k$29.8k
Q4 2025$3.4k$19.8k$33.1k
Q1 2026$3.9k$22.4k$38.6k
Q2 2026$4.3k$24.9k$45.7k
05

Two series side by side

Without stacked the series group inside each slot, 2px apart, and the slot still keeps about a third of its width as air. Seats in use against seats licensed is the honest form here: a stack would add them together, which would mean nothing.

fluid
Seat utilisation
In use against licensed, six largest accounts
Seat utilisation. In use against licensed, six largest accounts
ClientSeats in use (seats)Seats licensed (seats)
Lumen5760
Hyreflow4860
Meridian3460
Solstice2940
Orchard2020
Northwind1720
06

Share of one total

A donut with the total in the middle. Six channels, five chart tokens: the tail folds into “Other”, which names what it swallowed in the readout and in the hidden table — a sixth colour is never invented. Arcs are dash lengths on one circle, each shortened by the 2px gap, so a hovered segment thickens without any arc trigonometry.

fluid
Sessions by channel
Last 30 days, all workspaces
Sessions by channel. Last 30 days, all workspaces
ChannelValue (sessions)Share
Organic184.2K45%
Paid96.4K23%
Referral61.8K15%
Email38.2K9%
Other (covers Social, Direct)31K8%
Sessions411.6K100%
07

More series than colours

Seven accounts, five slots. The four largest keep their token and the rest become one “Other (3)” series, summed per month. Colour follows the entity, not its rank, so an account keeps its colour when the list is filtered — and the fifth slot is a real series, not a sixth invented hue.

fluid
Monthly recurring revenue
Every account, last twelve months
Monthly recurring revenue. Every account, last twelve months
PeriodLumen Retail (MRR)Hyreflow (MRR)Meridian Health (MRR)Solstice Media (MRR)Other (3) (MRR)
Sep 1, 2025$11.5k$7.9k$7.5k$6.2k$12.1k
Oct 1, 2025$11.7k$8.7k$7.3k$6.2k$12.3k
Nov 1, 2025$11.6k$9.3k$7.5k$6.3k$12.4k
Dec 1, 2025$11.9k$9.6k$8k$6.8k$12.5k
Jan 1, 2026$12.7k$9.6k$8.3k$7.2k$12.6k
Feb 1, 2026$13.5k$10k$8.2k$7.3k$12.9k
Mar 1, 2026$13.5k$10.9k$8.1k$7.2k$13.1k
Apr 1, 2026$13.4k$11.5k$8.3k$7.4k$13.2k
May 1, 2026$13.8k$11.6k$8.9k$7.9k$13.2k
Jun 1, 2026$14.8k$11.6k$9.1k$8.3k$13.4k
Jul 1, 2026$15.4k$12.1k$9k$8.3k$13.6k
Aug 1, 2026$15.4k$13.1k$8.8k$8.2k$13.8k
08

Compact, in a dashboard grid

size="sm" drops the plot to 132px and thins the axis to the ticks that still fit, which is what makes three of these sit in a row without turning into decoration. The value and the delta carry the headline; the plot carries the shape.

fluid
MRR
$37.2k+6.4%vs last month
MRR
PeriodLumen Retail
Sep 1, 2025$11.5k
Oct 1, 2025$11.7k
Nov 1, 2025$11.6k
Dec 1, 2025$11.9k
Jan 1, 2026$12.7k
Feb 1, 2026$13.5k
Mar 1, 2026$13.5k
Apr 1, 2026$13.4k
May 1, 2026$13.8k
Jun 1, 2026$14.8k
Jul 1, 2026$15.4k
Aug 1, 2026$15.4k
API calls
21,400+12.8%vs June
API calls
PeriodAPI calls
Jul 1, 202613.9K
Jul 2, 202614K
Jul 3, 202614.8K
Jul 4, 202615.5K
Jul 5, 202615.4K
Jul 6, 202615K
Jul 7, 202615.3K
Jul 8, 202616.2K
Jul 9, 202616.7K
Jul 10, 202616.5K
Jul 11, 202616.1K
Jul 12, 202616.6K
Jul 13, 202617.5K
Jul 14, 202618K
Jul 15, 202617.6K
Jul 16, 202617.3K
Jul 17, 202617.9K
Jul 18, 202618.9K
Jul 19, 202619.2K
Jul 20, 202618.7K
Jul 21, 202618.5K
Jul 22, 202619.3K
Jul 23, 202620.3K
Jul 24, 202620.4K
Jul 25, 202619.8K
Jul 26, 202619.7K
Jul 27, 202620.7K
Jul 28, 202621.6K
Jul 29, 202621.5K
Jul 30, 202620.9K
Sessions by channel
Sessions by channel
CategoryValueShare
Organic184.2K45%
Paid96.4K23%
Referral61.8K15%
Email38.2K9%
Other (covers Social, Direct)31K8%
Sessions411.6K100%
09

Loading

data={undefined}. The skeleton is the plot's own height and keeps the axis gutter, so nothing moves when the numbers land — including the headline figure and the legend row.

fluid
Monthly recurring revenue
Top three accounts, last twelve months
10

Nothing to plot yet

Empty series, not a failed load and not a filtered-out result. Reuses @automindz/empty-state at the plot's height, so a card in a grid keeps its box instead of collapsing and shoving its neighbours around.

fluid
Monthly recurring revenue
No accounts are billing yet
11

Failed to load

The failure replaces the plot, with role="alert", the reason spelled out and a retry that stays busy while it runs. Press it: this one succeeds. The header, the headline figure and the footer stay put — the card does not disappear because one query timed out.

fluid
API calls
All workspaces, July 2026
Usage is aggregated hourly and may lag by a few minutes.
12

A single point, and a gap

A brand-new workspace has one month of data. There is no path to draw, so the marker **is** the chart — without it a one-point series renders as an empty plot and reads as broken. The following month is null, which is a gap rather than a zero: the line stops instead of inventing a drop to the baseline.

fluid
Monthly recurring revenue
Quayside Brewing, since sign-up
$1,240
Monthly recurring revenue. Quayside Brewing, since sign-up
PeriodMRR (MRR)
Jul 1, 2026$1.2k
Aug 1, 2026No data
13

Every value is zero

A real answer, not an empty state: there genuinely were no refunds. The axis still resolves to 0–1 instead of dividing by a zero range, the baseline is drawn, and the plot says so in words — six invisible bars would look like a bug.

fluid
Refunds
Last six months, all workspaces
$0
Refunds. Last six months, all workspaces
PeriodRefunds
Mar 1, 2026$0
Apr 1, 2026$0
May 1, 2026$0
Jun 1, 2026$0
Jul 1, 2026$0
Aug 1, 2026$0
14

Long category names

Five client names that would collide on a vertical axis, or truncate to three characters each. orientation="horizontal" is the answer the form gives: the names run down the side with the room they need, and the value axis takes the width. Vertical bars ellipsize instead and keep the full name in the readout and the table.

fluid
Spend by client
Horizontal, so the names get the room they need
Spend by client. Horizontal, so the names get the room they need
ClientMonthly spend
Meridian Health Partners$9.2k
Northwind Laboratories$4.9k
Bright Harbour Consulting$4.1k
Kestrel Logistics International$780
Pine Ridge Dental Group$390
Spend by client
The same data vertically: names ellipsize to their band
Spend by client. The same data vertically: names ellipsize to their band
ClientMonthly spend
Meridian Health Partners$9.2k
Northwind Laboratories$4.9k
Bright Harbour Consulting$4.1k
Kestrel Logistics International$780
Pine Ridge Dental Group$390