A quarter of ECharts' weight. Up to 8.7× faster.
Write a chart as JSX: rows in, marks as children, field names checked against your row type. Axes, an accessible data table and a spoken description come without asking (the tooltip is one <Tooltip /> child), on canvas in the browser, as SVG on the server, and natively on iOS and Android.
bun add @pyreon/charts - vs ECharts 6
- 2.5–8.7× fasterall four timed operations, one run
- line chart, gzip
- 40.3 KBECharts 6, tree-shaken: 155.9 KB
- chart families
- 20, plus the cartesian markspie, sankey, treemap, candlestick, map…
- renders to
- canvas · SVG strings · iOS and Androidnative targets are experimental


- 8.7× faster than ECharts 6 to mount a 100,000-point line (4.36 vs 37.95 ms).BENCHMARKS.md §2, charts vs ECharts 6, final pass, one run, real Chromium, M3 Max
- 40.3 KB gzipped for a line chart. ECharts 6, tree-shaken the documented way: 155.9 KB.BENCHMARKS.md §7, bench:charts-bundle, re-measured 2026-11-19 (size build)
- 1.9× faster than uPlot to update a 10,000-point line (1.17 vs 2.25 ms).BENCHMARKS.md §2, charts-libs, final pass, two runs (1.89–1.92×, row input)
synthetic · author-run · M3 Max · record of 2026-11-05
Every result, including where we lose →Charts that behave like the rest of your UI.
Marks are children
A combo chart is a
<Bar>beside a<Line>. A second axis is<Line axis="right">plus<Axis y2>. Wrap a mark in<Show>and its series comes and goes with the signal.Typos fail typecheck
<Chart<Row>>checksxagainst your row. Declareconst RowBar = Bar<Row>once and everyy="revnue"is a type error. It compiles toBaritself, so it costs nothing.Accessible without asking
Every chart renders an offscreen data table and an
aria-labelwritten from the data: "rising 45% from 100 to 145". Left and Right walk the points; Up and Down switch series.Pay for what you draw
Each mark and family is an imported binding. A pie costs 19.8 KB gzipped (ECharts: 117.2 KB), and a chart without
<Toolbox>carries no tool strip. CI import budgets keep it that way.
The options object goes. The effect goes with it.
Register the pieces, init on a ref, resize by hand, dispose on unmount, and reshape your rows into parallel arrays on every change.
import { useEffect, useRef } from 'react'
import * as echarts from 'echarts/core'
import { BarChart, LineChart } from 'echarts/charts'
import { GridComponent, LegendComponent, TooltipComponent } from 'echarts/components'
import { CanvasRenderer } from 'echarts/renderers'
echarts.use([BarChart, LineChart, GridComponent, TooltipComponent, LegendComponent, CanvasRenderer])
type Row = { month: string; revenue: number; target: number }
export function Revenue({ rows }: { rows: Row[] }) {
const el = useRef<HTMLDivElement>(null)
const chart = useRef<echarts.ECharts | null>(null)
useEffect(() => {
const instance = echarts.init(el.current!)
chart.current = instance
const onResize = () => instance.resize()
window.addEventListener('resize', onResize)
return () => {
window.removeEventListener('resize', onResize)
instance.dispose()
}
}, [])
useEffect(() => {
chart.current?.setOption({
xAxis: { type: 'category', data: rows.map((r) => r.month) },
yAxis: { type: 'value', axisLabel: { formatter: (v: number) => `$${v}` } },
tooltip: { trigger: 'axis' },
legend: {},
series: [
{ type: 'bar', name: 'Revenue', data: rows.map((r) => r.revenue) },
{ type: 'line', name: 'Target', data: rows.map((r) => r.target) },
],
})
}, [rows])
return <div ref={el} style={{ height: 320 }} />
}Rows in, marks as children. Resizing, disposal and repaint on data change are the chart's job. Field names are checked.
import { Axis, Bar, Chart, Legend, Line, Tooltip, currency } from '@pyreon/charts'
type Row = { month: string; revenue: number; target: number }
const RowBar = Bar<Row>
const RowLine = Line<Row>
export const Revenue = (props: { rows: Row[] }) => (
<Chart<Row> data={props.rows} x="month" height={320}>
<RowBar y="revenue" label="Revenue" />
<RowLine y="target" label="Target" />
<Axis y format={currency('$')} />
<Tooltip />
<Legend />
</Chart>
)Coming from ECharts, Chart.js or Recharts?
An option object becomes a mark.
import * as echarts from 'echarts/core'
import { PieChart } from 'echarts/charts'
import { LegendComponent, TooltipComponent } from 'echarts/components'
import { CanvasRenderer } from 'echarts/renderers'
echarts.use([PieChart, TooltipComponent, LegendComponent, CanvasRenderer])
type Share = { browser: string; pct: number }
export function mountBrowsers(el: HTMLElement, share: Share[]) {
const chart = echarts.init(el)
chart.setOption({
tooltip: { trigger: 'item' },
legend: {},
series: [
{
type: 'pie',
radius: ['40%', '70%'],
data: share.map((d) => ({ name: d.browser, value: d.pct })),
},
],
})
return () => chart.dispose()
}innerRadius={0.57} is ECharts' ['40%', '70%'] as a fraction of the outer radius. The docs' migration table maps each series type to its mark: bar to <Bar>, pie to <Arc>, markLine to <Rule>, dataZoom to <Zoom>. On the four timed operations in the record, the same engine is 2.5–8.7× faster than ECharts 6 (one run).
import { Arc, Chart, Legend, Tooltip } from '@pyreon/charts'
type Share = { browser: string; pct: number }
export const Browsers = (props: { share: Share[] }) => (
<Chart<Share> data={props.share} height={280}>
<Arc value="pct" label="browser" innerRadius={0.57} />
<Tooltip />
<Legend />
</Chart>
)Stop copying data into the chart.
import { CategoryScale, Chart, Legend, LineController, LineElement, LinearScale, PointElement, Tooltip } from 'chart.js'
Chart.register(LineController, LineElement, PointElement, CategoryScale, LinearScale, Tooltip, Legend)
type Day = { day: string; visitors: number }
export function mountVisitors(canvas: HTMLCanvasElement, days: Day[]) {
const chart = new Chart(canvas, {
type: 'line',
data: {
labels: days.map((d) => d.day),
datasets: [{ label: 'Visitors', data: days.map((d) => d.visitors), tension: 0.3 }],
},
options: {
scales: { y: { ticks: { callback: (v) => `${Number(v) / 1000}k` } } },
},
})
// When the data changes, copy it back in and ask for a redraw.
return function load(next: Day[]) {
chart.data.labels = next.map((d) => d.day)
chart.data.datasets[0]!.data = next.map((d) => d.visitors)
chart.update()
}
}No register list, no chart.update(): the chart reads the signal. smooth is a monotone cubic, so it never draws a peak the data does not have. Against Chart.js 4 with decimation, bar mounts are 2.11–2.23× faster and 100,000-point updates 1.44–1.45× (two runs); a 1,000,000-point mount with row objects is 1.16–1.20× slower.
import { Axis, Chart, Legend, Line, Tooltip, compact, smooth } from '@pyreon/charts'
import { signal } from '@pyreon/reactivity'
type Day = { day: string; visitors: number }
export const visits = signal<Day[]>([])
export const Visitors = () => (
<Chart data={visits()} x="day" height={280}>
<Line y="visitors" label="Visitors" curve={smooth} />
<Axis y format={compact} />
<Tooltip />
<Legend />
</Chart>
)
// When the data changes, write the signal. The canvas repaints in place.
export function load(next: Day[]) {
visits.set(next)
}The same shape, on canvas, checked.
import { Bar, CartesianGrid, ComposedChart, Legend, Line, ResponsiveContainer, Tooltip, XAxis, YAxis } from 'recharts'
type Row = { month: string; revenue: number; target: number }
export const Revenue = ({ rows }: { rows: Row[] }) => (
<ResponsiveContainer width="100%" height={320}>
<ComposedChart data={rows}>
<CartesianGrid strokeDasharray="3 3" />
<XAxis dataKey="month" />
<YAxis tickFormatter={(v: number) => `$${v}`} />
<Tooltip />
<Legend />
<Bar dataKey="revenue" name="Revenue" fill="#8884d8" />
<Line dataKey="target" name="Target" stroke="#82ca9d" />
</ComposedChart>
</ResponsiveContainer>
)Recharts already composes with JSX, so the move is mostly renames: dataKey becomes y, ComposedChart becomes <Chart>, and ResponsiveContainer goes away because the chart fills its container. In the same run Recharts 3 took 644 ms to mount a 100,000-point line; the Pyreon engine took 5.77 ms.
import { Axis, Bar, Chart, Legend, Line, Tooltip } from '@pyreon/charts'
type Row = { month: string; revenue: number; target: number }
const RowBar = Bar<Row>
const RowLine = Line<Row>
export const Revenue = (props: { rows: Row[] }) => (
<Chart<Row> data={props.rows} x="month" height={320}>
<RowBar y="revenue" label="Revenue" />
<RowLine y="target" label="Target" />
<Axis y format={(v) => `$${v}`} />
<Tooltip />
<Legend />
</Chart>
)Swap the mark, keep the data.
Same rows, different marks. In the package this is one JSX child changing, and the canvas repaints in place.
<Chart data={rows()} x="month" by="month">
<Bar y="revenue" label="revenue" />
<Line y="target" label="target" dash={[5, 4]} />
<Axis y format={usd} />
<Tooltip /> <Legend />
</Chart>Tab into the chart, then use ← → to step through the months: the focus ring, the spoken description and the hidden data table come with every chart.
8.7× faster than ECharts at 100,000 points.
Every ECharts row is a win, and the line chart ships at a quarter of the size. Against uPlot and Chart.js, updates and bar mounts win and two line mounts tie. The default row-object input loses two line mounts by 1.16–1.20×; they are in the table. Every Pyreon run also builds an offscreen accessible data table, which no other library draws.
- mount 100,000 points (vs ECharts)4.36 ms37.95 mswin8.70× vs ECharts 6
- update 100,000 points (vs ECharts)5.74 ms29.56 mswin5.15× vs ECharts 6
- mount 1,000 points (vs ECharts)1.03 ms4.06 mswin3.9× vs ECharts 6
- update one of 1,000 (vs ECharts)722 µs1.82 mswin2.52× vs ECharts 6
- spec → SVG string (vs ECharts SSR)win7.4–8.2× across bars 1k, bars 10k, line 10k (bun, one run, median of 15, no CI)
- line chart bundle, gzip40.3 KB155.9 KBwin3.87× smaller than tree-shaken ECharts
- pie chart bundle, gzip19.8 KB117.2 KBwin5.9× smaller than tree-shaken ECharts
- update line, 10,000 (vs uPlot)1.17 ms2.25 mswin1.89–1.92× (rows); columns 2.06–2.08×
- update line, 100,000 (vs Chart.js)2.64 ms3.83 mswin1.44–1.45× (rows); columns 1.83–1.85×
- mount bars, 1,000 (vs Chart.js)5.28 ms11.24 mswin2.11–2.23× (both inputs)
- mount line, 100,000 (vs Recharts)5.77 ms644 msmeasured112× vs Recharts 3, one run (Recharts ran in run 1 only, no verdict)
- mount line, 1,000 (vs uPlot)2.79 ms2.76 mstietie, both inputs, both runs
- mount line, 100,000 (vs uPlot)5.77 ms5.26 mstietie, both inputs, both runs
- mount line, 10,000 (vs uPlot)3.84 ms3.19 mslossuPlot 1.17–1.20× (rows); columns lose run 1, tie run 2
- mount line, 1,000,000 (vs Chart.js)14.92 ms12.81 mslossChart.js 1.16–1.20× (rows); columns tie
A whole charting engine, and none of it borrowed.
- Cartesian marks:
Bar(stacked, grouped, waterfall),Line,Area,StackedArea,Dotwith area-mapped bubbles,Band,Histogram, error bars on every mark. - Indicators as marks:
Sma,Ema,TrendandBollingerlayer over the series they smooth. - Family marks:
<Arc>is a pie or donut,<Stage>a funnel,<Cell>a heatmap,<Candle>a candlestick. Same<Chart>, same grammar. - 16 family components: Sankey, treemap, sunburst, tree, graph, chord, river, polar, radar, gauge, gantt, calendar, parallel, boxplot, single axis and GeoJSON maps.
- Chrome as children:
Axis,Scale,Tooltip,Legend,ZoomandToolbox.ZoomandToolboxcarry their own code, so a chart without them ships no zoom or tool strip. - Keyed updates:
by="id"makes bars and lines slide, grow in and shrink out by row, like<For by>. - One formatter, every surface:
currency,percent,compact,fixedanddatefeed the axis, the tooltip and the accessible table at once.locale="de-DE"switches to Intl. - Long data and small multiples:
color="region"pivots long-format rows into one series per value;facet="region"draws one panel per value on a shared y domain. - Big series:next release M4 decimation before every stroke,
maxPointsthins with LTTB. The engine's marks (line,bars) also take aFloat64Arrayornumber[]column, a plainnumber[]used without a copy, anddensity="device"trades detail for speed. - SVG on the server:
chartToSvgplus a serializer per family, from@pyreon/charts/svg. Deterministic output, so a snapshot test asserts geometry, not pixels.
Things to build with it.
Push a reading every second and keep sixty. by="t" matches rows by key, so the line slides left instead of every point morphing into its neighbour.
import { onMount } from '@pyreon/core'
import { Chart, Line, Tooltip } from '@pyreon/charts'
import { signal } from '@pyreon/reactivity'
type Tick = { t: number; label: string; latency: number }
export const LiveLatency = (props: { read: () => number }) => {
const ticks = signal<Tick[]>([])
onMount(() => {
let t = 0
const id = setInterval(() => {
t += 1
const next = { t, label: `${t}s`, latency: props.read() }
ticks.update((rows) => [...rows.slice(-59), next])
}, 1000)
return () => clearInterval(id)
})
return (
<Chart data={ticks()} x="label" by="t" height={200} title="Latency, last 60 s">
<Line y="latency" label="Latency (ms)" />
<Tooltip />
</Chart>
)
}One createChartLink() shares the zoom window between charts, and the crosshair too once each has <Tooltip crosshair />. The navigator strip and the preset buttons sit under the price chart.
import { Bar, Chart, Line, Tooltip, Zoom, createChartLink } from '@pyreon/charts'
type Day = { day: string; close: number; volume: number }
export const PriceAndVolume = (props: { days: Day[] }) => {
const link = createChartLink()
return (
<>
<Chart<Day> data={props.days} x="day" height={240}>
<Line y="close" label="Close" />
<Tooltip crosshair />
<Zoom inside navigator link={link} presets={[{ label: '1M', count: 21 }, { label: 'All', count: 0 }]} />
</Chart>
<Chart<Day> data={props.days} x="day" height={120}>
<Bar y="volume" label="Volume" />
<Tooltip crosshair />
<Zoom inside link={link} />
</Chart>
</>
)
}On a server there is no canvas. chartToSvg returns an SVG string with role="img" and a title, ready for an email, a PDF or a static page.
import { chartToSvg } from '@pyreon/charts/svg'
import { bars, line } from '@pyreon/charts/engine'
type Row = { month: string; revenue: number; target: number }
const rows: Row[] = [
{ month: 'Jan', revenue: 3200, target: 3000 },
{ month: 'Feb', revenue: 4100, target: 3400 },
{ month: 'Mar', revenue: 3800, target: 3800 },
]
// A string, with no DOM: write it into an email, a PDF or a static page.
export const svg = chartToSvg({
data: rows,
x: (d) => d.month,
marks: [bars((d: Row) => d.revenue, { label: 'Revenue' }), line((d: Row) => d.target, { label: 'Target' })],
title: 'Monthly revenue',
width: 640,
height: 320,
})60 exports on the main entry. Two more entries for servers and tinkerers.
Every export has a reference page with its signature, an example and the mistakes people make with it.
- Chart
- Bar
- Line
- Area
- StackedArea
- Dot
- Band
- Histogram
- Rule
- Label
- Arc
- Stage
- Cell
- Candle
- Sma
- Ema
- Trend
- Bollinger
- Axis
- Scale
- Tooltip
- Legend
- Zoom
- Toolbox
- SankeyChart
- TreemapChart
- SunburstChart
- TreeChart
- GraphChart
- ChordChart
- RiverChart
- PolarChart
- RadarChart
- GaugeChart
- GanttChart
- CalendarChart
- ParallelChart
- BoxplotChart
- SingleAxisChart
- MapChart
- registerMap
- geoShapes
- gaugeDial
- visualMap
- currency
- percent
- compact
- fixed
- date
- plain
- formatDate
- registerLocale
- smooth
- step
- ChartThemeProvider
- useChartTheme
- chartThemes
- palettes
- createChartLink
- createChartHandle
- chartToSvg
- pieToSvg
- sankeyToSvg
- treemapToSvg
- geoToSvg
- PlotChart
- bars
- line
- area
- points
- sonifyValues
Good to know before you start.
Give the marks the row type too
<Chart<Row>> checks the chart's own channels. JSX cannot pass a type argument down to children, so declare const RowBar = Bar<Row> once to check a mark's field names.
iOS and Android are experimental
The engine is generated into Swift and Kotlin and <Chart> draws natively. Column inputs, density, locale, facet, <Histogram> and the event props (onSelect taps do cross) stay on the web, and the compiler names each one.
The server draws the first frame
Import @pyreon/charts/svg on the server and every chart ships its first frame as SVG in the HTML. Tooltips, zoom and keyboard focus attach in the browser.
Stay on the main entry
@pyreon/charts/engine exposes every layout, hit test and the array form <PlotChart>. It is useful and it is outside the stability promise.
What people ask first.
Is this a wrapper around ECharts?
Not any more. It used to be. The engine that replaced it is plain TypeScript over a flat draw list, and the package depends on nothing outside Pyreon. The docs carry a table from ECharts options to marks, and pyreon check lists any import still on the old wrapper.
Canvas or SVG?
Canvas in the browser: one element, however many points. SVG on the server, from the same draw list, through @pyreon/charts/svg. Import that entry on the server and every <Chart> ships its first frame as SVG in the HTML.
Where does it lose?
Mounting a line from row objects: 1.17–1.20× behind uPlot at 10,000 points and 1.16–1.20× behind Chart.js at 1,000,000 (two runs). The columnar input coming in the next release (a number[] column instead of row objects) ties Chart.js at a million. Every Pyreon run also builds the accessible table, which the others skip.
Does it run on iOS and Android?
Yes, experimentally. The geometry is generated into Swift and Kotlin and compiled by the real toolchains on every change, and <Chart> and the family components lower to a native canvas over the same draw list. VoiceOver gets an Audio Graph through AXChartDescriptor. What stays web-only is named at compile time.
How big is it, really?
40.3 KB gzipped for a line chart and 19.8 KB for a pie, measured beyond a 12.1 KB Pyreon runtime baseline (size build, 2026-11-19). Tree-shaken ECharts: 155.9 KB and 117.2 KB.
Can I trust the numbers?
They are author-run and synthetic, on one M3 Max. Every one comes with its run count, and the harness is in the repo: bun bench-scenarios.ts --scenario charts in examples/benchmark. Run it.
Delete the options object. Keep the chart.
bun add @pyreon/charts