ModaChart — Chart Library

Headless charting — drill-down, sync, candlestick, choropleth.

A headless chart library that draws 35 chart types identically in React, Vue, Svelte, and plain JS.

All logic — scales, interaction, events — lives in a pure TypeScript core; each framework adapter is just a thin reactive binding. Every renderer emits the same DOM contract, so output is identical.

Includes paid-tier features like zoom, navigator, drilldown, drawing annotations, and chart sync — plus a built-in world map and sparklines — in ~250KB.

Free (MIT)React · Vue 3 · Vue 2.7 · Svelte 5 · Vanilla35 chart typesSVG rendering · ~250KB

Live demo

Runs on the real core loaded from CDN. Switch between every chart type — line, bar, pie, candlestick, sankey, sunburst, world map — and try legend, tooltip, zoom, brush, navigator, point select, context menu, drilldown, and drawing annotations (trendline/Fibonacci/range). The panel below shows code reproducing your settings in real time.

Loading moda-chart core from CDN…

Packages by environment

EnvironmentPackageNotes
React@moda-chart/reactChartView component + useChartCore hook (useSyncExternalStore)
Vue 3@moda-chart/vueuseChart + ChartView, shallowRef-based reactivity
Vue 2.7@moda-chart/vue2Same Composition API as Vue 3
Svelte 5@moda-chart/sveltereadable store binding + ChartView
Vanilla JS / CDNmoda-chart.jsOne <script>, no build — window.ModaChart
No framework@moda-chart/coreUse headless ChartCore + mountChart directly

Install via npm

npm i @moda-chart/react # React
npm i @moda-chart/vue # Vue 3
npm i @moda-chart/vue2 # Vue 2.7
npm i @moda-chart/svelte # Svelte 5
npm i @moda-chart/core # Headless core only

Use via CDN

https://chart.modaolive.com/moda-chart.js
https://chart.modaolive.com/style.css

Get started in 3 steps

  1. 1

    Install package

    Install an adapter like npm i @moda-chart/react, or load the core with a single CDN <script>.

  2. 2

    Type + data

    Just pass type with series·categories. Per-type data fields like points·ohlc·tree·links are added when needed.

  3. 3

    Render & control

    Adapters need one <ChartView>. Vanilla's mountChart(el, options) wires up the DOM and all interactions.

// npm i @moda-chart/react
import { ChartView, useChartCore } from "@moda-chart/react";
import "@moda-chart/react/styles.css";

function App() {
  const { chart, snapshot } = useChartCore({
    type: "line",
    series: [
      { name: "Sales", values: [12, 24, 16, 30] },
      { name: "Cost", values: [8, 14, 12, 20] },
    ],
    categories: ["Jan", "Feb", "Mar", "Apr"],
    legend: { position: "top" },
    tooltip: { mode: "shared" },
    zoom: true,
  });
  return <ChartView chart={chart} />;
}
// later changes via core methods like chart.setData / chart.setType

Usage by feature

Chart types (35)

FeatureHow to enableAPI
Cartesiantype: "line"|"step"|"spline"|"area"|"bar"|"stacked-bar"|"percent-stacked-bar"|"waterfall"|"histogram"|"range-bar"|"range-area"|"population-pyramid"chart.setType(type) runtime switch
Circular · polar"pie"|"donut"|"nightingale"|"radial-bar"|"radial-column"|"radar"|"radar-area"categories = angle, values = radius
Distribution · finance"scatter"|"bubble"|"heatmap"|"candlestick"|"ohlc"|"boxplot"points {x,y,z} / ohlc / box / series matrix
Flow · hierarchy"funnel"|"cone-funnel"|"pyramid"|"sankey"|"chord"|"sunburst"|"treemap"|"organization"|"wordcloud"series.tree / links / chord.matrix
Gauge · map"gauge"|"linear-gauge"|"pictogram"|"map"gauge:{min,max,target} / map:{topology} + built-in WORLD_TOPOLOGY
Mixed seriesseries[].type set per seriesline + bar combo chart
Horizontaldirection: "horizontal" (bar types)value axis moves to x-axis

Data

FeatureHow to enableAPI
Category axiscategories: string[] / number[] / Date[]string=band, number=linear, Date=time auto
Replace data—chart.setData(series, categories)
Update point—chart.updatePoint(...) — realtime updates (gauge, etc.)
Per-point styleseries[].itemStyle: (ctx) => ({color?, name?})equivalent to AG Charts itemStyler
Error bars · trendlinesseries[].errors / series[].trendtrend: { type: "linear"|"movingAverage" }
Grouped categoriescategories: [[group, leaf], …] tuplesrenders a second tick row

Interactions

FeatureHow to enableAPI
Legendlegend: true | { position }click toggle + hover dimming / toggleLegend / hoverLegend
Legend checkboxeslegend: { checkboxes: true }legendCheck event { id, checked }
Tooltiptooltip: "point"|"shared"|{ mode, format, render }shared includes crosshair; render for custom HTML
Zoom · panzoom: true | { wheel, pan, axes, select }setZoomWindow / resetZoom — x/y/xy axis selection
Brush selectionbrush: true — drag to select rangeselectionChange event / setSelection
Navigator · scrollbarnavigator: true | scrollbar: truecontrol window via minimap or thin zoom strip
Drill-downdrilldown: { "label": childLevel }drillDown/drillUp/drillUpAll + ‹Back button
Point selectallowPointSelect: trueselectPoint / clearSelected, .mc-selected
Context menucontextMenu: true | { items }built-in zoom reset/SVG·PNG export + custom items menuAction
Chart syncsync: "groupKey"same-key charts share hover·zoom
Touch pinch zoomautomatic (when zoom on)focal-anchor zoom from finger spacing
OS theme syncautomatictracks prefers-color-scheme — syncs chart vars when OS goes dark

Annotations · export · a11y

FeatureHow to enableAPI
Draw annotationsdrawing: true + chart.setDrawMode(tool)line/hline/vline/rect/channel/fibonacci/measure + getDrawings
Save SVG·PNGbuilt into contextMenu or call directlydownloadSVG / downloadPNG export
Sparkline—mountSparkline — axis-free mini chart
State save/restore—getState / setState — round-trips zoom·hidden·annotations
Keyboard navauto — moves point focusincludes a11y attrs like aria-pressed
Theme--chart-* CSS vars + palette cyclingcustomize via .mc-* class DOM contract
Print eventsautomaticbeforePrint / afterPrint events

Recipes by use case

Drill-down

Click a point to descend into child data — ‹Back auto-provided

new ChartCore({
  type: "bar",
  series: [{ name: "Monthly", values: [12, 24, 16] }],
  categories: ["Jan", "Feb", "Mar"],
  drilldown: {
    "Jan": {
      series: [{ name: "Jan weekly", values: [3, 4, 2, 3] }],
      categories: ["Wk 1", "Wk 2", "Wk 3", "Wk 4"],
      title: "Jan weekly sales",
    },
  },
});

chart.drillUp();   // back one level

Annotations

Trendlines·Fibonacci retracement·region measurement — AG Charts premium-level features

chart.setDrawMode("fibonacci"); // drag → 0~100% retracement levels
chart.setDrawMode("channel");   // parallel channel + shaded band
chart.setDrawMode("measure");   // auto Δx/Δy labels

chart.getDrawings();      // DrawingInput[] (data coords)
chart.clearDrawings();
chart.setDrawMode(null);  // release (Esc works too)

Real-time data

setData is idempotent — same-ref calls ignored, reactive-loop safe

setInterval(() => {
  series[0].values.push(rand()); series[0].values.shift();
  chart.setData(series, categories);   // re-renders when the ref is a new array
}, 1000);

// to change a single point, like a gauge
chart.updatePoint(seriesId, 0, nextValue);

Chart sync

Charts with the same group key share hover·zoom — for multi-chart dashboards

mountChart(elA, { type: "line", series, categories, sync: "dash" });
mountChart(elB, { type: "bar",  series, categories, sync: "dash" });

// zoom/hover on one propagates to the other on the same domain
// (propagated changes are not re-propagated — no loop)

Candlestick (stock)

Up/down candles from ohlc — colors via --chart-up/down-color

new ChartCore({
  type: "candlestick",
  categories: ["10/1", "10/2", "10/3"],
  series: [{
    name: "Price",
    ohlc: [
      [100, 108, 97, 105],   // [open, high, low, close]
      [105, 110, 101, 103],
      [103, 112, 102, 111],
    ],
  }],
});

World map (choropleth)

Built-in Natural Earth 110m topo — join by code, axis-free region chart

import { WORLD_TOPOLOGY } from "@moda-chart/core"; // on CDN: window.ModaChart.WORLD_TOPOLOGY

new ChartCore({
  type: "map",
  series: [{
    name: "Users by country",
    mapData: { KOR: 92, JPN: 64, USA: 88, DEU: 40 },
  }],
  map: { topology: WORLD_TOPOLOGY, projection: "mercator" },
});
// unjoined regions get .mc-map-no-data; gradient legend bottom-right

Source & docs

Guides (full chart-type table, interactions, theme vars, migration mapping) live in the public release repo.

park-taejoon/moda-chart-releases

How to use

Headless charting — drill-down, sync, candlestick, choropleth.

chart library

Related tools