Chart

Molecule

Token-aware primitive chart library at @/modules/ui/Chart. M1 ships seven SVG-based charts (Line, Bar, Area, Pie, Donut, Scatter, SparkLine) that consume a unified `Series` data shape. Colors auto-resolve from --primary / --secondary / --success / --warning / --error / --info, so dark mode and theme swaps work without any extra work. Pixel-identical EJS sibling at modules/ui/Chart/Chart.ejs. M3+ stubs (BubbleChart, HeatmapChart, TreemapChart, RadarChart, FunnelChart, SankeyChart, CandlestickChart, GaugeChart) are exported but render null until implemented; see PLANS/38-Charts.md.

LineChart

Preview

Daily active users vs new signups

  • Active users
  • New signups
Code
<LineChart
  series={[
    { id: 'active',  name: 'Active users', data: [{ x: 'Mon', y: 1200 }, /* … */] },
    { id: 'signups', name: 'New signups',  data: [{ x: 'Mon', y: 300 },  /* … */] },
  ]}
  height={220}
/>

BarChart

Preview

Revenue vs expenses (monthly)

  • Revenue
  • Expenses
Code
<BarChart
  series={[
    { id: 'revenue',  name: 'Revenue',  data: [{ x: 'Jan', y: 4200 }, /* … */] },
    { id: 'expenses', name: 'Expenses', data: [{ x: 'Jan', y: 2800 }, /* … */] },
  ]}
  radius={4}
/>

AreaChart

Preview

Engagement over the week (smoothed)

  • Active users
  • New signups
Code
<AreaChart series={series} smooth fillOpacity={0.18} />

PieChart

Preview

Sales by category

  • Electronics
  • Clothing
  • Food
  • Books
  • Other
Code
<PieChart
  series={[{
    id: 'share', name: 'Category share',
    data: [
      { x: 'Electronics', y: 35 },
      { x: 'Clothing',    y: 25 },
      { x: 'Food',        y: 20 },
      { x: 'Books',       y: 12 },
      { x: 'Other',       y: 8 },
    ],
  }]}
/>

DonutChart

Preview

Sales by category (donut)

  • Electronics
  • Clothing
  • Food
  • Books
  • Other
Code
<DonutChart series={pieSeries} innerRadius={0.62} />

SparkLine

Preview

Inline sparklines

MRR 
+24%
DAU 
+8%
Code
<SparkLine values={[12, 14, 11, 17, 19, 16, 22]} width={120} height={28} filled />
<SparkLine values={[5, 7, 6, 9, 8, 11]} width={120} height={28} />
Sourcemodules/ui/Chart/index.ts