Skip to content

Size and lazy loading ​

You ship what you draw. nervure has no dependency, and each chart is a module of its own.

In the bundleMinifiedGzippedBrotliTime to bundle
One chart: gauge13.2 kB5.9 kB5.3 kB9 ms
One chart: pie15.9 kB7.1 kB6.4 kB9 ms
Lines and bars27.2 kB11.4 kB10.3 kB7 ms
Candlestick16.9 kB7.5 kB6.8 kB6 ms
Map22 kB9.5 kB8.6 kB6 ms
Every chart137.6 kB48 kB41.3 kB30 ms
Live data only2.3 kB1.1 kB1 kB2 ms

With nervure/lazy, 6.7 kB load at the start, and each chart type is a file of its own. Building the SVG of a chart takes 0.5 ms in the middle of the 84 samples and 9.7 ms for the slowest, in jsdom. Measured on 2026-12-01 with esbuild, unknown, Node v22.23.5. Run it yourself: npm run bench.

Pick your charts ​

ts
import { createChart, registerChart } from 'nervure/core';
import { pie } from 'nervure/charts/basic/pie';
import { xy } from 'nervure/charts/basic/xy/index';

registerChart('pie', pie);
registerChart('xy', xy);

The rest never enters your bundle. The source folder lists the paths.

Load when drawn ​

ts
import { createChart, load } from 'nervure/lazy';

const chart = await createChart(host, spec);  // fetches the code of its type, once
await load('sankey', 'map');                  // ahead of time

Vite, webpack, Rollup, esbuild and Parcel make a small file of each type. Before you give another type to chart.update, call load for it.

In a framework ​

nervure/react, nervure/vue and nervure/svelte hold every chart. nervure/react/core, nervure/vue/core and nervure/svelte/core hold none: register those you draw.

tsx
import { registerChart } from 'nervure/core';
import { gauge } from 'nervure/charts/basic/gauge';
import { Chart } from 'nervure/react/core';

registerChart('gauge', gauge);

While it runs ​

A chart that is drawn does nothing: no loop, no timer. Live charts stop in hidden tabs, and draw at most ten times a second.