Charts

The data visualization suite — six components: Stat, Sparkline, Bar List, Donut, Bar Chart, Line Chart. All hand-rolled SVG or pure CSS — no charting library. Every chart adopts the active theme automatically via the --lb-data-1..8 palette tokens.

a11y (built in): every SVG chart is role="img" with an aria-label the component regenerates on each render — a plain-text summary of the real data ("Sparkline: 24 points, rising from 12 to 48", "Bar chart over 6 categories — …"), so the chart is never an unlabelled graphic. Donut segments additionally carry a per-segment <title>; Stat and Bar List are ordinary text and markup and need nothing added.

Usage: The whole suite lives in core js/lb.js — one script, no chart library, auto-init on DOMContentLoaded. Stat is pure CSS; Bar List is markup plus a tiny initialiser that turns each row's data-lb-value into a proportional bar width (largest row = 100%); Sparkline is configured entirely by attributes (data-lb-data comma list, data-lb-variant, data-lb-dot); Donut, Bar Chart and Line Chart read a <script type="application/json"> config child, exactly as the demos below show. Charts dispatch no events — they are render-only; push live data through the instances instead: el._lbSparkline.setData(arr), el._lbDonut.setData(data), el._lbBarChart.setData(cfg) and el._lbLineChart.setData(cfg) re-render in place. Fetching, polling and number formatting stay consumer code — the DS never bundles a data layer.

Compose with: Card for surface, Grid for KPI strips, Table for tabular adjacency, Resizable for dashboard layouts.


Data palette — eight tokens

Categorical series colors. Each chart picks --lb-data-1 first, walking the palette as it adds series. Light theme uses the 500-level palette; dark theme bumps to 400-level for visibility on dark surfaces. Override per-instance with the colors JSON config (or style="--color: …" on Sparkline / Bar List).

data-1
data-2
data-3
data-4
data-5
data-6
data-7
data-8

Stat — KPI primitive

Label + big number + optional delta chip and caption. Pure HTML/CSS, no JS. The foundation of every dashboard. Drop inside Card, compose with Sparkline.

Revenue
$284k
12.4% vs last month
Customers
2,184
64
See full Stat demo →

Sparkline — inline mini chart

Line, area, or bar with no axes or chrome. Scales fluidly to its host's CSS size. Pairs with Stat for the metric card pattern.

MRR
$54,210
8.1% vs last month
Sessions
31.4k
4.8%
See full Sparkline demo →

Bar List — ranked rows

Top countries, top sources, top pages. Pure HTML/CSS layout. Drops into Card for a stand-alone widget.

Top referrers
  • google.com2,486
  • github.com1,190
  • x.com864
  • linkedin.com412
See full Bar List demo →

Donut — proportions

Same-radius circles with stroke-dasharray arcs. Configurable thickness (set to 50 for a pie). Optional center value slot, paired legend list.

Storage used
42.8 GB of 100 GB
43%
  • Used 42.8 GB
  • Free 57.2 GB
See full Donut demo →

Bar Chart — categorical

Vertical or horizontal, single or multi-series, grouped or stacked. Round-number axis ticks, hover tooltips, auto legend.

Weekly active users
Trailing 4 weeks · plan breakdown
See full Bar Chart demo →

Line Chart — time-series

Single or multi-series, line or area fill. Per-point hover dots with a unified multi-series tooltip showing every series at the hovered x position.

MRR — last 90 days
Free vs Pro vs Enterprise
See full Line Chart demo →

All together — the dashboard

See every chart in one place — Stat, Sparkline, Bar List, Donut, Bar Chart, and Line Chart composed with Card, Table, Resizable rails, and Tree navigation into a real product UI.

Open the dashboard composition →