Raster
Light, accessible SVG charts for React. No d3, zero runtime dependencies, themable through a small set of CSS custom properties.
Raster is a small React chart library by Eeko Digital: LineChart, BarChart, DonutChart, ScatterChart, Sparkline, Gauge, LinearGauge, RadarChart and GeoChart.
Up to version 2 it was a design system; since version 3 it’s only charts. Upgrading? See Migrating.
Design goals
Section titled “Design goals”These goals decide what goes into raster and what stays out. Where a chart doesn’t meet one yet, the gap is listed.
| Goal | Where it stands |
|---|---|
| Light. No feature bloat. | Zero runtime dependencies. Each chart is its own entry point, mostly 5–6.5 KB min+gzip including the shared accessibility layer (LineChart about 8 KB, Sparkline about 2 KB). Date axes, export and the accessibility frame are opt-in entries. GeoChart and its topojson-client peer live at @eekodigital/raster/geo, so the main entry never pulls them in. CI checks every entry against a size tripwire. |
| Themable enough for our apps. | Charts read a documented set of --raster-* custom properties, and every one has a fallback, so an unthemed chart is still legible. Per-series and per-datum color props override the theme. See Theming charts. |
| SVG, for accessibility and interactivity. | Each chart is a labelled figure with a generated summary, a visible data-table toggle, and SVG marks named like “Pass, Feb: 12, 2 of 6” that you reach with one Tab stop and arrow keys. See Accessibility. |
| Not based on d3. | Scales, ticks, curves and arcs come from raster’s own chart-math (about 260 lines). |
| TypeScript native. | Written in TypeScript; types ship with the package. |
| Responsive. | Every chart fills its container unless given a fixed size, and draws at display pixels. Cartesian charts take a height or an aspectRatio, sized in CSS so server-rendered and hydrated layouts match, and thin or rotate labels to fit. |
Quick start
Section titled “Quick start”pnpm add @eekodigital/raster// Once, at your app root:import "@eekodigital/raster/styles.css";
// Anywhere:import { LineChart } from "@eekodigital/raster";
<LineChart series={[{ name: "Visitors", data: [120, 180, 150, 240] }]} categories={["Mon", "Tue", "Wed", "Thu"]} title="Visitors this week"/>;