Chart · ui · 48K

Chart

A dependency-free pixel chart kit: BarChart, LineChart, AreaChart, PieChart and Sparkline rasterised onto the 1px grid and filled with 8×8 one-bit patterns (or the 16-colour palette), with ticked axes, dotted grid lines, a pattern legend, a framed tooltip with selection handles, arrow-key reading and a hidden data table for screen readers.

Pass data, xKey and series [{ key, label, pattern?, color? }], or wrap charts in a ChartContainer with a shadcn-style config keyed by series (or pie slice name). Patterns: solid, dark, gray, light, dots, diagonal, diagonal-reverse, horizontal, vertical, grid, weave, bricks, white. color takes a palette name ("red", "dark-green"…) or any CSS colour. Charts take the container's width and a fixed height in px; there is no viewBox scaling, so every line stays one pixel. Not recharts: shadcn chart examples need porting.

Install

pnpm dlx shadcn@latest add @s7ui/chart

Example

Visitors by Device

Visitors by device, January to June
MonthDesktopMobileTablet
Jan1868042
Feb30520061
Mar23712088
Apr7319054
May20913097
Jun214140120

Visitors, Stacked

Visitors by device, stacked
MonthDesktopMobileTablet
Jan1868042
Feb30520061
Mar23712088
Apr7319054
May20913097
Jun214140120

Temperature (°C)

Daily high and low temperature
DayHighLow
Mon146
Tue178
Wed125
Thu91
Fri113
Sat157
Sun1810

Disk Usage

Disk usage by kind
KindMB%
Documents38 MB24%
Applications64 MB40%
System22 MB14%
Fonts9 MB6%
Free27 MB17%

In Colour

Visitors in colour
monthDesktopMobile
Jan18680
Feb305200
Mar237120
Apr73190
May209130
Jun214140

This Week

Visitors2,431
Orders318
Returns12
Sessions5,980
Load41%

Info

Files:
components/ui/chart.tsx
Uses:
@s7ui/theme, @s7ui/bitmap
Packages:
—