Charts · line, bar, pie & more

Fourteen SVG charts that size to their box and follow the theme: line, area, column, bar, pie, donut, scatter, bubble, radar, heatmap, gauge, funnel, treemap, radial bar and waterfall. Data can be a signal — change it and the chart animates from the old numbers to the new ones, axes included. Colours come from the theme's --zap-chart-1…8 tokens in a fixed order, so a series keeps its colour when others are hidden.

Hover for values · click a legend entry to hide a series
Revenue by channelline · $K per month
$20K$40K$60K$80K$100K$120KJanFebMarAprMayJunJulAugSepOctNovDec
Traffic sourcesarea · overlaid
020406080JanFebMarAprMayJunJulAugSepOctNovDec
Sales by regioncolumn
0204060Q1Q2Q3Q4
Top productsbar · units sold
0200400600800AuroraNimbusVertexPulseEcho797553423441252
Market sharedonut
79points
Sessions by devicepie
Dealsbubble · days open × win score, size = value
020406080100020406080100
Model comparisonradar
SpeedAccuracyCostRecallLatencyCoverage
Server loadgauge
31%CPU0%100%
82%Memory0%100%
Activity ringsradial bar · % of goal
Signup funnelfunnel
Visited12K 100%Signed up4,524 37.7%Activated1,872 15.6%Subscribed903 7.5%Renewed476 4%
Busiest hoursheatmap · orders per 2 h
Mon412113455848810388755531Tue1113286775999588825632Wed310335978939894796646Thu413102955889510491776337Fri14414264868995103886332Sat8144214146565243382724Sun1441624253753504934372000:0004:0008:0012:0016:0020:000104
Spendingtreemap · $K
Payroll210Cloud174Office210Marketing75Software90Legal76Other (3)92
Tiny chartssparkline + CSS bars
Mon
Tue
Wed
Thu
Fri
Sat
Sun
Profit & losswaterfall · $K
0100200300400RevenueCOGSGrossR&DSalesG&AOtherNet+391-169222-74-64-27-651

Usage

JavaScript
import { signal } from "./index.js";import { LineChart, AreaChart, ColumnChart, BarChartH, PieChart, DonutChart, ScatterChart,         RadarChart, Heatmap, Gauge, Funnel, Treemap, RadialBar, WaterfallChart } from "./components/chart.js"; // Data may be plain, a signal or a getter — set it and the chart tweens to the new numbers.const series = signal([{ name: "Online", data: [62, 70, 75] }, { name: "Retail", data: [48, 44, 51] }]);LineChart({ labels: ["Jan", "Feb", "Mar"], series, format: (v) => "$" + v + "K" })AreaChart({ labels, series, stacked: true })ColumnChart({ labels: ["Q1", "Q2", "Q3", "Q4"], series, stacked: false })   // horizontal: true → barsDonutChart({ data: [{ label: "Kartex", value: 42 }, { label: "Others", value: 58 }], centerLabel: "points" })ScatterChart({ series: [{ name: "Won", data: [{ x: 12, y: 80, r: 40 }] }] })   // r → bubblesRadarChart({ axes: ["Speed", "Cost", "Recall"], series, max: 100 })Heatmap({ x: hours, y: days, values: grid, showValues: true })Gauge({ value: cpu, label: "CPU", format: (v) => v + "%" })Funnel({ data: [{ label: "Visited", value: 12000 }, { label: "Signed up", value: 4100 }] })Treemap({ data: spend })          // > 8 entries fold into "Other"RadialBar({ data: [{ label: "Move", value: 72 }] })WaterfallChart({ data: [{ label: "Revenue", value: 420 }, { label: "COGS", value: -150 }, { label: "Net", total: true }] })