Chart

MetricChart

Smart wrapper that routes to Recharts (SVG) by default and ECharts (Canvas) when data is dense or renderer="canvas" is passed. Built for S3: VPS metrics drop in straight from Prometheus-style scrapes.

Preview

Import

ts
import { MetricChart } from '@gautham/design-system/charts'

Usage

tsx
// Small series — stays on Recharts
<MetricChart data={points} xKey="t" yKeys={["cpu"]} />

// Dense time-series — routes to ECharts canvas
<MetricChart data={bigPoints} xKey="t" yKeys={["cpu"]} renderer="canvas" />

Renderer: Routes: SVG → Canvas

When not to use

SVG is always faster for < 500 points. Canvas becomes a win over ~2k; the auto-switch at 5k is conservative. ECharts and echarts-for-react are optional peers — install them in the host app to enable the Canvas path.