Skip to content
@pyreon/charts
fundamentals · data visualisation

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
Documentation
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
Four real @pyreon/charts renders: an area chart of revenue over 14 days, a bar chart of revenue by category, a two-series line chart of revenue and profit by month, and a donut chart of device share.Four real @pyreon/charts renders: an area chart of revenue over 14 days, a bar chart of revenue by category, a two-series line chart of revenue and profit by month, and a donut chart of device share.
  • 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 →
why teams pick it

Charts that behave like the rest of your UI.

  1. 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.

  2. Typos fail typecheck

    <Chart<Row>> checks x against your row. Declare const RowBar = Bar<Row> once and every y="revnue" is a type error. It compiles to Bar itself, so it costs nothing.

  3. Accessible without asking

    Every chart renders an offscreen data table and an aria-label written from the data: "rising 45% from 100 to 145". Left and Right walk the points; Up and Down switch series.

  4. 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 difference

The options object goes. The effect goes with it.

React + ECharts 6

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 }} />
}
with @pyreon/charts

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

Coming from ECharts, Chart.js or Recharts?

An option object becomes a mark.

ECharts
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()
}
Pyreon

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.

Chart.js
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()
  }
}
Pyreon

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.

Recharts
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>
)
Pyreon

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>
)
try it

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.

mark
data
<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.

Monthly figures against target
Categoryrevenuetarget
Jan$42K$45K
Feb$51K$50K
Mar$48K$55K
Apr$63K$60K
May$71K$65K
Jun$68K$70K
Jul$84K$75K
Aug$92K$80K
benchmarks

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.

vs ECharts 6, uPlot 1.6, Chart.js 4 and Recharts 3 · real Chromium, M3 MaxPyreonrival · lower is better
  • mount 100,000 points (vs ECharts)
    4.36 ms
    37.95 ms
    win8.70× vs ECharts 6
  • update 100,000 points (vs ECharts)
    5.74 ms
    29.56 ms
    win5.15× vs ECharts 6
  • mount 1,000 points (vs ECharts)
    1.03 ms
    4.06 ms
    win3.9× vs ECharts 6
  • update one of 1,000 (vs ECharts)
    722 µs
    1.82 ms
    win2.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, gzip
    40.3 KB
    155.9 KB
    win3.87× smaller than tree-shaken ECharts
  • pie chart bundle, gzip
    19.8 KB
    117.2 KB
    win5.9× smaller than tree-shaken ECharts
  • update line, 10,000 (vs uPlot)
    1.17 ms
    2.25 ms
    win1.89–1.92× (rows); columns 2.06–2.08×
  • update line, 100,000 (vs Chart.js)
    2.64 ms
    3.83 ms
    win1.44–1.45× (rows); columns 1.83–1.85×
  • mount bars, 1,000 (vs Chart.js)
    5.28 ms
    11.24 ms
    win2.11–2.23× (both inputs)
  • mount line, 100,000 (vs Recharts)
    5.77 ms
    644 ms
    measured112× vs Recharts 3, one run (Recharts ran in run 1 only, no verdict)
  • mount line, 1,000 (vs uPlot)
    2.79 ms
    2.76 ms
    tietie, both inputs, both runs
  • mount line, 100,000 (vs uPlot)
    5.77 ms
    5.26 ms
    tietie, both inputs, both runs
  • mount line, 10,000 (vs uPlot)
    3.84 ms
    3.19 ms
    lossuPlot 1.17–1.20× (rows); columns lose run 1, tie run 2
  • mount line, 1,000,000 (vs Chart.js)
    14.92 ms
    12.81 ms
    lossChart.js 1.16–1.20× (rows); columns tie
Apple M3 Max · record of 2026-11-05 · final pass: ECharts one run, uPlot / Chart.js / Recharts two runs (Recharts run 1 only); bundle sizes re-measured 2026-11-19 (size build) · author-run, syntheticFull method, every loss →
what's included

A whole charting engine, and none of it borrowed.

  • Cartesian marks: Bar (stacked, grouped, waterfall), Line, Area, StackedArea, Dot with area-mapped bubbles, Band, Histogram, error bars on every mark.
  • Indicators as marks: Sma, Ema, Trend and Bollinger layer 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, Zoom and Toolbox. Zoom and Toolbox carry 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, fixed and date feed 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, maxPoints thins with LTTB. The engine's marks (line, bars) also take a Float64Array or number[] column, a plain number[] used without a copy, and density="device" trades detail for speed.
  • SVG on the server: chartToSvg plus a serializer per family, from @pyreon/charts/svg. Deterministic output, so a snapshot test asserts geometry, not pixels.
recipes

Things to build with it.

A live chart that keeps the last minute

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>
  )
}
Price and volume, zoomed together

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>
    </>
  )
}
A chart in an email

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,
})
api

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 and marks · 14
  • Chart
  • Bar
  • Line
  • Area
  • StackedArea
  • Dot
  • Band
  • Histogram
  • Rule
  • Label
  • Arc
  • Stage
  • Cell
  • Candle
indicators · 4
  • Sma
  • Ema
  • Trend
  • Bollinger
chrome · 6
  • Axis
  • Scale
  • Tooltip
  • Legend
  • Zoom
  • Toolbox
families · 20
  • SankeyChart
  • TreemapChart
  • SunburstChart
  • TreeChart
  • GraphChart
  • ChordChart
  • RiverChart
  • PolarChart
  • RadarChart
  • GaugeChart
  • GanttChart
  • CalendarChart
  • ParallelChart
  • BoxplotChart
  • SingleAxisChart
  • MapChart
  • registerMap
  • geoShapes
  • gaugeDial
  • visualMap
format and curves · 10
  • currency
  • percent
  • compact
  • fixed
  • date
  • plain
  • formatDate
  • registerLocale
  • smooth
  • step
theme and control · 6
  • ChartThemeProvider
  • useChartTheme
  • chartThemes
  • palettes
  • createChartLink
  • createChartHandle
@pyreon/charts/svg · 5
  • chartToSvg
  • pieToSvg
  • sankeyToSvg
  • treemapToSvg
  • geoToSvg
@pyreon/charts/engine (no stability promise) · 6
  • PlotChart
  • bars
  • line
  • area
  • points
  • sonifyValues
good to know

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.

questions

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
Read the charts guide