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

    Class ChartData

    Render-ready view of a dataset, with O(log n) push for streaming/real-time appends.

    x/y[i] are exact-length (=== n) views over doubling-capacity backing buffers, so x.length === n holds for the binary search while appends stay amortized O(1). x must be non-decreasing; push enforces it, the batch constructor trusts the caller (perf).

    Index

    Constructors

    Properties

    Methods

    Constructors

    Properties

    n: number
    stats: SeriesStats[]
    x: Float64Array
    y: Float64Array<ArrayBufferLike>[]

    Methods

    • Replace the y-values of the LAST sample (x unchanged) — O(log n), for in-flight samples that keep changing, e.g. a forming candle or a ticking last price. Values must be finite.

      Stats caveat: min/max only widen under amends. If the amended value was the sole extreme and retreats, the recorded extreme stays until the next setData. For the intended use this never happens (a forming candle's high/low only extend), and a one-amend-wide extreme is the conservative direction for axis fitting.

      Parameters

      • ys: readonly number[]

      Returns void

    • Append one sample. x must be >= the current last x (non-decreasing). Updates the data, the per-series min/max pyramids (O(log n) each), and the stats — never an O(n) rebuild.

      Parameters

      • xv: number
      • ys: readonly number[]

      Returns void

    • Full x-domain [first, last]; falls back to [0, 1] when empty.

      Returns [number, number]

    • Combined y-extent across the series flagged visible.

      Parameters

      • visible: readonly boolean[]

        Per-series visibility (index-aligned with the series). Missing or true entries count as visible.

      Returns [number, number]

      [min, max], widened to a unit span when degenerate so scales never collapse.