Framework adapters

Use Sixtyfold line and stock charts from React, Vue, Angular, Svelte, and SolidJS.

Sixtyfold's framework packages are thin lifecycle adapters around the same LineChart and StockChart engines. They do not duplicate rendering logic, reshape data, add runtime telemetry, or pull every chart into your application.

Install one adapter plus the engine you use. Import only its /line or /stock entry point:

pnpm add @sixtyfold/react@1 @sixtyfold/line@1
import { SixtyfoldLineChart } from "@sixtyfold/react/line";

Replace react with vue, angular, svelte, or solid. For a stock chart, install @sixtyfold/stock and import /stock. Chart engines are optional peer dependencies of the adapter, so installing a line chart does not install stock.

Shared adapter contract

All adapters create the chart after the component mounts, wait for initialize(), apply reactive inputs, and call destroy() on unmount. This also terminates a chart worker and releases observers, listeners, and large buffer references. During SSR the component emits only its canvas host; use @sixtyfold/ssr when the server must paint chart pixels.

Prop/inputLine typeStock typeBehavior
optionsLineChartOptionsStockChartOptionsConstruction-time snapshot. Remount the adapter to replace it; use appearance for live visual changes.
dataTimeSeriesData | MultiSeriesDataOHLCVDataOne-shot transferable bulk data, reactive by object identity. Always assign fresh buffers with a fresh object.
dataUpdateOptionsLineDataUpdateOptions—Reactive settings for animated line-data replacement, including preservePreviousFrame; changing them alone does not retransfer installed data.
appearanceDeepPartial<LineAppearanceOptions>DeepPartial<StockAppearanceOptions>Deep visual patch applied without recreating the chart or replacing data.
viewportPartial<Viewport>Partial<Viewport>Reactive X range. Supply xMin, xMax, or both in the chart’s X units.
viewportAnimatedbooleanbooleanOverrides animation for the corresponding viewport update. Leave undefined to inherit chart options.
statsIntervalMsnumbernumberMinimum telemetry callback interval in milliseconds; telemetry stays disabled without a listener.
readiness callback/eventLineChartStockChartFires once per chart instance after initialization and the first successful data, appearance, and viewport prop batch; does not wait for a painted frame.
error callback/eventunknownunknownReports construction and reactive prop-installation errors, renderer initialization/runtime failures, and overlay resolution or delivery failures.
stats callback/eventLineChartStatsStockChartStatsReports renderer and data telemetry at statsIntervalMs.
series-visibility callback/eventSeriesVisibilityChangeEvent—Reports visibility changes from initialization, API calls, and the interactive legend.

Every adapter reports readiness, construction and prop-installation errors, renderer and overlay errors, plus render statistics. Line adapters also report SeriesVisibilityChangeEvent. Each framework exposes the underlying LineChart or StockChart instance through its conventional ref or component API, so uncommon imperative operations remain available.

Readiness means the initial props have been accepted, not that their first canvas frame has been painted. Imperative changes made in the ready callback are not overwritten by a deferred initial prop batch.

Handle chart failures

Adapter error hooks accept unknown because JavaScript construction errors are not required to use a particular class. Failures emitted by the Sixtyfold renderer are ChartRendererError instances. Overlay resolution or renderer-delivery failures are ChartOverlayError instances. Narrow the value before reading structured fields:

import {
  ChartOverlayError,
  ChartRendererError,
} from "@sixtyfold/line";

export function reportChartError(error: unknown) {
  if (error instanceof ChartRendererError) {
    console.error(error.phase, error.message);
    return;
  }
  if (error instanceof ChartOverlayError) {
    console.error("Overlay sources failed:", error.sources);
    return;
  }
  console.error(error);
}

Use the same import from @sixtyfold/stock in a stock-only application. error.phase is either "initialization" or "runtime". A renderer failure destroys that chart instance; remount the adapter if the application chooses to recover. An overlay failure is non-fatal: successful items remain installed; if every requested item fails, the previously rendered overlay remains.

A rejected reactive prop installation reports an error and withholds the initial ready notification. Supply corrected props to retry without remounting. Data already installed successfully is not transferred again when a later prop fails. This recovery does not apply to terminal renderer errors.

Bulk typed arrays transfer to the worker. Treat each data object as one-shot: do not mutate it in place, and assign a fresh object with fresh buffers for each update. This preserves the zero-copy path for multi-million-point datasets.

React

import { useMemo, useRef } from "react";
import {
  SixtyfoldLineChart,
  type LineChartHandle,
} from "@sixtyfold/react/line";

export function Signals() {
  const chartRef = useRef<LineChartHandle>(null);
  const data = useMemo(() => ({
    x: new Float64Array([0, 1, 2, 3]),
    y: new Float64Array([3, 7, 4, 9]),
    length: 4,
  }), []);

  return (
    <SixtyfoldLineChart
      ref={chartRef}
      data={data}
      aria-label="Signal history"
      onError={console.error}
    />
  );
}

The component accepts ordinary canvas attributes. Its ref exposes ref.current?.chart. Initial construction is microtask-deferred so React Strict Mode's development lifecycle probe cannot transfer the initial data twice.

React 19.2+ Activity can hide and reveal a chart without recreating its renderer or retransferring data. Prop installation and readiness/error notifications wait until reveal; stats and series-visibility callbacks are disconnected while hidden. The retained worker and buffers are released when the component is actually unmounted, including an unmount while hidden.

React disconnects the forwarded ref while hidden. A previously captured handle also returns null from .chart until reveal. React 18 and earlier React 19 releases destroy charts on unmount through passive cleanup, including charts hidden by a re-suspended Suspense boundary.

React-only surfaceTypeDescription
refRef<LineChartHandle | StockChartHandle>Forwarded handle whose chart field contains the mounted imperative instance or null.
native canvas attributesCanvasHTMLAttributes<HTMLCanvasElement>Passed to the canvas, excluding children. Use them for aria-label, class names, inline style, tests, and pointer metadata.
onReady(chart) => voidCalled once after initialization and the first successful reactive prop batch.
onError(error: unknown) => voidCalled for construction, reactive prop installation, renderer initialization/runtime, or overlay resolution/delivery failure.
onStats(stats) => voidEnables and receives renderer telemetry.
onSeriesVisibilityChange(event) => voidLine-only series visibility callback.

Vue

<script setup lang="ts">
import { shallowRef } from "vue";
import { SixtyfoldLineChart } from "@sixtyfold/vue/line";

const data = shallowRef({
  x: new Float64Array([0, 1, 2, 3]),
  y: new Float64Array([3, 7, 4, 9]),
  length: 4,
});
</script>

<template>
  <SixtyfoldLineChart
    :data="data"
    aria-label="Signal history"
    @error="console.error"
  />
</template>

Use shallowRef or markRaw for bulk data instead of Vue deep proxies. The component emits ready, error, and stats; line charts also emit seriesVisibilityChange. A template ref exposes its shallow chart ref.

Stats collection follows reactive listeners. A sole @stats.once listener disables collection after its first event; an ordinary @stats listener keeps it enabled. A consumed .once listener remains consumed for that component's lifetime.

Vue surfaceTypeDescription
shared propsSee the framework prop indexVue props use the same names and types as the shared contract.
ready eventLineChart | StockChartEmits the chart after initialization and the first successful reactive prop batch.
error eventunknownEmits construction, reactive prop-installation, renderer initialization/runtime, or overlay resolution/delivery failure.
stats eventLineChartStats | StockChartStatsEnables and emits telemetry.
seriesVisibilityChange eventSeriesVisibilityChangeEventLine-only visibility event.
inherited attributesNative canvas attributesUnrecognized attributes such as aria-label, class, and style are forwarded to the canvas.
template ref chartShallowRef<LineChart | StockChart | null>Exposes the mounted imperative chart without deep proxying it.

Angular

The Angular 20–22 package uses standalone components and Angular Package Format secondary entry points.

import { Component } from "@angular/core";
import { SixtyfoldLineChartComponent } from "@sixtyfold/angular/line";

@Component({
  standalone: true,
  imports: [SixtyfoldLineChartComponent],
  template: `
    <sixtyfold-line-chart
      [data]="data"
      ariaLabel="Signal history"
      (chartError)="reportError($event)"
    />
  `,
})
export class Signals {
  data = {
    x: new Float64Array([0, 1, 2, 3]),
    y: new Float64Array([3, 7, 4, 9]),
    length: 4,
  };

  reportError(error: unknown) {
    console.error(error);
  }
}

Inputs follow the shared table plus focused accessibility fields and canvasAttributes. Outputs are chartReady, chartError, and stats; the line component also emits seriesVisibilityChange. A component reference exposes its public chart.

Stats collection is enabled only while an active subscriber can receive the stats output. It stops after the last subscriber unsubscribes, including take(1), and when the output completes, errors, or is closed.

Angular's application builder does not transform package-owned Vite worker URLs. Add the engines used by the application to the build target's assets array in angular.json:

[
  { "glob": "**/*", "input": "node_modules/@sixtyfold/line/dist/assets", "output": "assets" },
  { "glob": "**/*", "input": "node_modules/@sixtyfold/stock/dist/assets", "output": "assets" }
]

Chart construction is guarded with isPlatformBrowser, so Angular SSR does not touch browser globals.

Angular inputTypeDescription
optionsLineChartOptions | StockChartOptionsConstruction-time snapshot.
dataLineData | OHLCVDataOne-shot transferable reactive dataset.
dataUpdateOptionsLineDataUpdateOptionsLine-only replacement animation options.
appearanceDeepPartial<LineAppearanceOptions | StockAppearanceOptions>Reactive visual patch.
viewportPartial<Viewport>Reactive X-domain patch.
viewportAnimatedboolean | undefinedAnimation override for the viewport input.
statsIntervalMsnumber | undefinedMinimum telemetry interval when stats has subscribers.
canvasClassstringClass applied to the inner canvas.
ariaLabelstringAccessible canvas name.
ariaDescribedBystringIDs of adjacent text or table alternatives that describe the chart.
canvasRolestringExplicit canvas role; normally let the chart choose application or img.
canvasTabIndexnumberExplicit tab order; view-only charts are omitted by default.
canvasAttributesRecord<string, string | number | boolean | null | undefined>Additional canvas attributes such as test hooks and metadata. Class, style, size, role, tab order, and the focused accessibility inputs remain managed separately.
Angular outputPayloadDescription
chartReadyLineChart | StockChartEmits the chart after initialization and the first successful reactive prop batch.
chartErrorunknownEmits construction, reactive prop-installation, renderer initialization/runtime, or overlay resolution/delivery failure.
statsLineChartStats | StockChartStatsEnables and emits renderer telemetry.
seriesVisibilityChangeSeriesVisibilityChangeEventLine-only visibility output.
public chartLineChart | StockChart | nullImperative instance exposed on a component reference.

Svelte

<script lang="ts">
  import LineChart from "@sixtyfold/svelte/line";

  const data = {
    x: new Float64Array([0, 1, 2, 3]),
    y: new Float64Array([3, 7, 4, 9]),
    length: 4,
  };
</script>

<LineChart
  {data}
  ariaLabel="Signal history"
  onError={console.error}
/>

chart is bindable for imperative access. Additional Svelte props are onReady, onError, onStats, onSeriesVisibilityChange for line charts, canvasClass, canvasStyle, and ariaLabel.

Svelte prop/bindingTypeDescription
shared propsSee the framework prop indexUses the shared options, data, appearance, viewport, telemetry, and callback props.
onReady(chart) => voidReceives the chart after initialization and the first successful reactive prop batch.
onError(error: unknown) => voidReports construction, reactive prop-installation, renderer initialization/runtime, or overlay resolution/delivery failure.
onStats(stats) => voidEnables and receives telemetry.
onSeriesVisibilityChange(event) => voidLine-only visibility callback.
canvasClassstringClass applied to the canvas.
canvasStylestringCSS declaration text applied to the canvas.
ariaLabelstringAccessible canvas name.
bindable chartLineChart | StockChart | nullMounted imperative chart; resets to null on cleanup.

SolidJS

import { SixtyfoldLineChart } from "@sixtyfold/solid/line";

const data = {
  x: new Float64Array([0, 1, 2, 3]),
  y: new Float64Array([3, 7, 4, 9]),
  length: 4,
};

export function Signals() {
  return (
    <SixtyfoldLineChart
      data={data}
      canvasProps={{ "aria-label": "Signal history" }}
      chartRef={(chart) => console.log(chart)}
      onError={console.error}
    />
  );
}

chartRef receives the mounted chart and later null during cleanup. canvasProps passes native canvas attributes. All other props follow the shared contract.

SolidJS-only surfaceTypeDescription
chartRef(chart | null) => voidReceives the mounted imperative chart and later null during cleanup.
canvasPropsJSX.CanvasHTMLAttributes<HTMLCanvasElement>Native canvas attributes, accessibility metadata, class, style, and test hooks.
onReady(chart) => voidCalled after initialization and the first successful reactive prop batch.
onError(error: unknown) => voidCalled for construction, reactive prop installation, renderer initialization/runtime, or overlay resolution/delivery failure.
onStats(stats) => voidEnables and receives telemetry.
onSeriesVisibilityChange(event) => voidLine-only visibility callback.

Complete examples

The public repository includes a minimal responsive application for each supported framework. Each application shows the packages, data shape, chart setup, and cleanup needed to reproduce both a line and a stock chart.