@mk7s/holochart-runtime
v0.1.0-alpha.0
Published
Chart runtime: createChart, pipeline orchestration, update API, events, and the trace-render / component contracts (ADR-019).
Maintainers
Readme
@mk7s/holochart-runtime
The Holochart chart runtime: createChart, the pipeline from figure to pixels, the update API,
events and the module registry. It is the entry point of a partial bundle. Part of
Holochart, declarative GPU charts on three.js.
Alpha. Released as
0.1.0-alphaon the npmalphatag; APIs can change between 0.x releases. Most apps should install the full bundle,@mk7s/holochart, which includes this package.
Install
pnpm add @mk7s/holochart-runtime@alpha threethree is a peer dependency, so your app and Holochart share one copy. ESM-only; Node 22 and
newer can also require() it.
What it exports
- Charts:
createChart(returns aChartwithreact,relayout,restyle,update,on,destroy),getChart - Plotly-style API:
newPlot,react,restyle,relayout,update,addTraces,extendTraces,animate,purge,toImage,downloadImage,fromJSON,chartToJSON - Registration:
register,registry,createChartRegistry,defineTemplate,setDefaultTemplate. Theholochart,plotly-classicandnonetemplates are registered already. - Contracts: the
TraceModuleandComponentModuletypes that trace packages and plugins implement. These are experimental until the plugin API stabilises.
The runtime registers no trace types and no components but hover labels: register the ones you use.
Usage
import { createChart, register } from '@mk7s/holochart-runtime';
import { builtinComponents } from '@mk7s/holochart-components';
import { basicTraces } from '@mk7s/holochart-traces-basic';
register(...basicTraces, ...builtinComponents);
const chart = createChart(el, { data: [{ type: 'bar', x: ['a', 'b'], y: [2, 3] }] });
chart.on('click', ({ points }) => console.log(points));
await chart.relayout({ 'yaxis.range': [0, 5] });Docs
License
MIT (see LICENSE).
