fcharts-js - v0.3.0
    Preparing search index...

    Class FChart

    fcharts — fast, accessible charts.

    Renders 100k+ points at 60fps on a canvas while remaining keyboard-navigable, screen-reader-announced, and find-in-page-able through a real-DOM accessibility layer.

    Index

    Constructors

    Accessors

    Methods

    • Replace the y-values of the LAST sample in place (x unchanged) — O(log n). The streaming companion to append for samples that keep changing while they form: amend the forming candle (or ticking last price) on every update, then append the next one when its bucket opens. Values must be finite; throws on an empty chart.

      The y-axis refits when the view is following the live tail, exactly like append.

      Parameters

      • ys: readonly number[]

      Returns FChart

    • Append one sample for real-time/streaming data — amortized O(1) (only the tail pyramid buckets update), never an O(n) rebuild. x must be >= the current last x; ys must have one value per series.

      When the view is following the live tail, the y-domain auto-fits the new data and the view tracks it — a zoomed window slides (keeping its width), a full-history view expands. If you've panned back into history it stays put — same view, same axis — so you can keep reading the past.

      Accessibility: append updates content on its own, so if you drive it on a timer you are creating auto-updating content — provide a Pause/Stop control (WCAG 2.2.2). The library never auto-updates by itself, so the cadence and its controls are yours.

      Parameters

      • xv: number
      • ys: readonly number[]

      Returns FChart

    • Subscribe to x-domain changes — wheel/keyboard zoom, drag pan, pager pans, cursor follow-pans, and programmatic renderSync(domain) all notify (after clamping, only when the domain actually changed). setData's full-extent reset does not. Returns an unsubscribe function. See syncCharts for the linked multi-pane helper built on it.

      Parameters

      • cb: (domain: readonly [number, number]) => void

      Returns () => void

    • Render immediately and synchronously, optionally to a given x-domain. Bypasses the rAF scheduler — useful for programmatic zoom, print/offscreen capture, and deterministic benchmarking.

      Parameters

      • Optionaldomain: readonly [number, number]

      Returns FChart

    • Structured, machine-readable summary of the current data — per-series min/max/first/ last/mean, change, and trend. The same object is embedded as JSON in the DOM and distilled into the chart's accessible description, so screen readers and AI agents get the values a bare <canvas> chart hides.

      Returns ChartSummary

    • The full current dataset as CSV (RFC 4180 quoting): an x column (named after xLabel), then one column per line/area series and four (open/high/low/close, localized via strings) per candle series. Values are raw — not run through formatX/formatY — so the export round-trips; hidden series are included. The same data the hidden table samples, but complete.

      Returns string

    • Serialize the current view to a standalone, accessible <svg> string — the same downsampled envelope the canvas draws, plus real <text> ticks and a <title>/<desc>. Useful for print, embedding, or feeding a tactile-graphics pipeline (a non-visual export the EU data-viz guide recommends). Falls back to the configured size if not yet measured.

      Returns string

    • Patch series, options, and/or data in place. Updatable options take effect immediately (labels, formatters, tick counts, modes, callbacks). legend, sonify, exportControl, and strings wire subsystems at construction and cannot change here: a patch that would change one throws (passing the current value is a no-op). Recreate the chart to change them — the React adapter remounts automatically.

      Parameters

      Returns FChart