chart

Docs › Frameworks and server

Import only the charts you use: smaller 82chart bundles (lite, charts, features)

With @82chart/core/lite and use(), a bar + line page is about 37 KB gzipped. A server-only renderToSVG entry, size table and examples.

Modular imports put only the chart types and features a page uses into its bundle. In 82chart 0.5 you start from @82chart/core/lite and register what you need with use(): a page with bar and line charts is about 36.8 KB gzipped, a third less than everything (55.1 KB).

import { createChart } from '@82chart/core' still has everything (14 chart types, realtime, zoom, the export menu, patterns, four languages); nothing changes for existing code.

import { createChart, use } from '@82chart/core/lite';
import { bar, line } from '@82chart/core/charts';      // or '@82chart/core/charts/bar'
import { zoom, exporting } from '@82chart/core/features';
use(bar, line, zoom, exporting);

createChart('#sales', { type: 'bar', data, zoom: true });
  • Chart types (@82chart/core/charts): line, area, bar, scatter, pyramid, waterfall, pie, donut, radar, gauge, heatmap, calendar, treemap, funnel, or allCharts. A bar chart with a line series on top needs only its type.
  • Features (@82chart/core/features): realtime (append, tweens, live patches), zoom (drag, pinch, wheel, zoom buttons), exporting (the menu, PNG, Excel) and patterns; allFeatures for all.
  • Stock charts: add candlestick and ohlc from @82chart/stock to the same use() (Stock charts).
  • Languages: lite has Korean and English; add others with import { ja } from '@82chart/core/locales/ja'; registerLocale('ja', ja).
  • An unregistered type draws pie: use(pie) and warns once in the console; a missing feature is simply off (no zoom buttons, no menu). toPNG() and toXLSX() throw without exporting; toCSV() and toSVG() always work.
  • Tooltips, keyboard, legend and the screen-reader table are always in: accessibility is never left out.

On servers: @82chart/core/server

On Node, Cloudflare Workers, Deno and Bun use the entry without any DOM code. Every chart type is registered.

import { renderToSVG, renderToXLSX } from '@82chart/core/server';

const svg = renderToSVG(options, { width: 800 });
const xlsx = await renderToXLSX(options); // Uint8Array (an Excel file)

Sizes

Minified with esbuild, measured with gzip -9.

What is in it0.4.10.5.0
82chart.min.js (CDN, everything)51.2 KB59.3 KB
@82chart/core, everything (ESM, bundler)47.9 KB55.1 KB
lite + bar + line–36.8 KB
lite + bar + line + zoom + exporting–42.5 KB
lite + line + realtime–39.9 KB
lite + pie + donut–38.8 KB
@82chart/core/server (renderToSVG)31.4 KB*34.4 KB
lite + @82chart/stock candlestick–30.7 KB
82chart-stock.min.js (extra CDN file)–5.9 KB

* 0.4.1 had no server entry: that is renderToSVG taken from @82chart/core and tree-shaken. The 0.5 server entry is a little bigger because trend, comparison and table code grew, and it is guaranteed to hold no DOM code. The full files grew mostly for the xlsx writer (about 2.5 KB) and trend lines and comparison (about 1 KB).

Entries

NameWhat it is
@82chart/coreThe default entry with everything registered (as before)
@82chart/core/liteThe small entry with nothing registered: createChart, renderToSVG, renderToXLSX, use, format helpers
use(...modules)Registers chart types and features; takes arrays; registering twice is fine
@82chart/core/chartsline … funnel, allCharts (or one at a time, @82chart/core/charts/bar)
@82chart/core/featuresrealtime, zoom, exporting, patterns, allFeatures
@82chart/core/serverrenderToSVG, renderToXLSX, format helpers (no DOM)
@82chart/core/kitSVG, scale and number helpers for building chart modules (may change before 1.0)

Frequently asked questions

Do I have to change my code?

No. @82chart/core still registers every chart type and feature. Switch only the pages you want smaller to @82chart/core/lite.

Does lite keep tooltips, keyboard, legend and the table?

Yes. Tooltips, keyboard reading, the legend and the screen-reader summary and table are always in; what is left out is unregistered chart types and the realtime, zoom, export menu and pattern features.

Can I use a small build from the CDN?

0.5 ships the full CDN file only (about 59 KB gzipped). Make small bundles with npm and a bundler (Vite, webpack, esbuild …).