GitHubGitHub

Data visualization

Charts

Two engines, one theme: uPlot renders the realtime time-series widgets in the core package; ECharts powers categorical, composition, and flow charts behind an optional subpath.

Which engine when

uPlot (ships in the core install) draws TimeSeriesChart, AreaChart, and Sparkline — it stays fast at hundreds of points per second on live dashboards. ECharts (opt-in) adds BarChart, DonutChart, Heatmap, and SankeyChart — richer layouts where the data is aggregate, not streaming. Both re-render in the active theme's tokens automatically.

Install the ECharts pack

pnpm add echarts
import { BarChart, DonutChart, Heatmap, SankeyChart } from '@chanrg/4ui/echarts';<BarChart {categories} {series} unit="kWh" stacked />

The subpath registers only the chart types it uses via echarts/core, so your bundle carries roughly a third of full ECharts. The main @chanrg/4ui entry never imports it.

Live example

Escape hatch

EChart accepts any raw ECharts option, keeps it themed, resizes with its container, applies streaming livePatch updates, and exposes getInstance() when you need the underlying API.