Skip to content

Documentation / @finchart/core / index / validateSeriesData

Function: validateSeriesData() ​

Call Signature ​

validateSeriesData(data, coordinates?, seam?): SeriesDataIssue[] | null

Defined in: packages/core/src/data/validate.ts:389

Checks untrusted series data before it goes in, and reports what is wrong as a value — codes, indices, messages — instead of making the consumer fish a thrown DataError out of a catch (e: unknown).

null means exactly one thing: setData(data) with the same accessor will not throw a DataError. The rules are not a copy — ingestion and this door walk the same scanSeriesData.

Never throws. A payload that is not an array is itself reported (not-an-array, index −1) — a fetch result of unknown shape is the very thing this exists to check. Issues come back ascending by index.

ts
const issues = validateSeriesData(payload, new OHLCAccessor());
if (issues) return showError(issues);
handle.setData(payload);

Parameters ​

data ​

readonly LineDataPoint[]

coordinates? ​

undefined

seam? ​

SeamContext

Returns ​

SeriesDataIssue[] | null

Call Signature ​

validateSeriesData<T>(data, coordinates, seam?): SeriesDataIssue[] | null

Defined in: packages/core/src/data/validate.ts:394

Checks untrusted series data before it goes in, and reports what is wrong as a value — codes, indices, messages — instead of making the consumer fish a thrown DataError out of a catch (e: unknown).

null means exactly one thing: setData(data) with the same accessor will not throw a DataError. The rules are not a copy — ingestion and this door walk the same scanSeriesData.

Never throws. A payload that is not an array is itself reported (not-an-array, index −1) — a fetch result of unknown shape is the very thing this exists to check. Issues come back ascending by index.

ts
const issues = validateSeriesData(payload, new OHLCAccessor());
if (issues) return showError(issues);
handle.setData(payload);

Type Parameters ​

T ​

T extends BaseDataPoint

Parameters ​

data ​

readonly T[]

coordinates ​

CoordinateAccessor<T>

seam? ​

SeamContext

Returns ​

SeriesDataIssue[] | null