MatesCharts v0.6.0

API reference

The entire public surface of mates-charts: one component, one atom factory, two theme hooks and the Highcharts re-export.

Exports

ExportKindDescription
ChartcomponentRenders a Highcharts instance bound to a chart atom. Factory to interpolate in html templates.
chartAtomfactoryWraps Highcharts.Options in a reactive mates atom. Safe to call at module scope.
useThemeAtomWithHighchartshookWires the mates theme to Highcharts.setOptions — light/dark defaults on every change. Idempotent.
useAdaptiveThemehookReturns a shared atom of the resolved theme ("light" | "dark", never "auto").
HighchartsvalueThe Highcharts core instance — for setOptions, namespaces and factories.

Entry points: "mates-charts" (core + the most-used modules, auto-registered) and "mates-charts/core" (bare core, zero modules). "mates-charts/modules" registers the full Tier-A set explicitly.

Chart(chart, options?)

PropTypeDefaultDescription
chartChartAtomTyperequiredReactive options atom created by chartAtom(…).
options.theme"light" | "dark" | (() => "light" | "dark")follows themeAtomPer-chart theme override. A getter is re-evaluated reactively — "auto" resolves via themeAtom.resolved.

The rendered root is a div at width:100%; height:100% — size it from the parent container.

chartAtom(config) → ChartAtomType

MemberDescription
atom() / .get()Reactive read of the current Highcharts.Options — registers a dependency when called inside a render/effect scope.
.set(options | updater)Replace the config (or derive from the previous one). Mounted charts re-run chart.update(config, true, true).
.update(fn)In-place mutation — allowed because the config is deliberately not frozen (Highcharts mutates it internally).
.valNon-reactive snapshot.

How it maps to Highcharts

mates-chartsHighcharts equivalent
chartAtom(opts)Highcharts.Options — the same object, wrapped in a reactive atom
Chart(atom)Highcharts.chart(el, opts) on mount, plus lifecycle teardown
atom.set(opts)chart.update(opts, true, true) — automatic
useThemeAtomWithHighcharts()Highcharts.setOptions(theme) on every theme change

Everything else — titles, axes, legends, tooltips, plotOptions, responsive rules — is the Highcharts 12 API, unchanged. The Highcharts demo gallery is also a mates-charts recipe book: paste any demo's options into chartAtom(…).

Beyond the wrapper — the Highcharts escape hatch

mates-charts re-exports the full Highcharts namespace, so nothing is locked away. Whatever Highcharts can do, you can do — imperatively, alongside the reactive API.

Escape hatch
import { Highcharts, chartAtom } from "mates-charts";

// 1 · global defaults — fonts, colours, locale
Highcharts.setOptions({
    chart: { style: { fontFamily: "Inter, sans-serif" } },
});

// 2 · a custom series type from the registry
const SeriesRegistry = Highcharts.SeriesRegistry;
// …extend any series prototype and register it — it then works via
// chartAtom({ series: [{ type: "mySeries", … }] })

// 3 · factory access for imperative charts outside mates templates
const chart = Highcharts.chart(document.getElementById("mini"), {
    series: [{ data: [1, 2, 3] }],
});

Chart instances are also reachable per component — pass chart.events in the config and the handlers receive the instance (this), as shown in the dynamic charts family.