Skip to content

Documentation / @finchart/core / index / LineSeries

Class: LineSeries<T> ​

Defined in: packages/core/src/series/line-series.ts:54

A data representation that can be swapped out on the same stage (Plot).

The grid, axes, pan/zoom, and layers belong to Plot, so they stay put even when the series changes. A series answers five things — how much of the y axis it occupies, how it draws, and (optionally) how its points are thinned, how their coordinates are read, and what a tooltip says about one of them (describe, the series' alone — no registration overrides it). The two policies are resolved registration first, then the series, then the fallback: a registration's coordinates wins over the series', and plain x/y reads when neither says; a registration's decimation fields win over the series' field by field, and the wiring's policy fills what neither sets.

Extended by ​

Type Parameters ​

T ​

T extends BaseDataPoint = LineDataPoint

Implements ​

Constructors ​

Constructor ​

new LineSeries<T>(options): LineSeries<T>

Defined in: packages/core/src/series/line-series.ts:60

Parameters ​

options ​

LineSeriesOptions<T>

Returns ​

LineSeries<T>

Properties ​

coordinates ​

readonly coordinates: CoordinateAccessor<T>

Defined in: packages/core/src/series/line-series.ts:57

How to read coordinates from its own point. Omitted means reading x and y directly. It's here for the same reason as decimation — a candle's value is close (OHLC has no y), and only the candle knows that.

Implementation of ​

Series.coordinates

Methods ​

draw() ​

draw(target, context): void

Defined in: packages/core/src/series/line-series.ts:104

The line breaks at a gap — a separate drawLine call for each run where values are unbroken. Drawing it as one continuous line would let the line cross a spot with no data — like an indicator's warmup span (MA(20)'s first 19 points) — making a missing value look like it's there.

Parameters ​

target ​

DrawTarget

context ​

SeriesContext<T>

Returns ​

void

Implementation of ​

Series.draw


toPath() ​

protected toPath(run): Point[]

Defined in: packages/core/src/series/line-series.ts:73

Turns a connected run into a path to draw. Default is a no-op.

Step is a subclass rather than an option because of bundle budget — as an option it would become a branch in draw, and a consumer that never uses step would still ship that code. As a subclass, it drops out entirely for anyone who doesn't use it.

Parameters ​

run ​

Point[]

Returns ​

Point[]


valueExtent() ​

valueExtent(data): Range | null

Defined in: packages/core/src/series/line-series.ts:82

A gap isn't counted — treating a missing value as 0 would drag the value axis all the way down to 0. null when everything is a gap, since there's nothing to measure.

Parameters ​

data ​

DataView<T>

Returns ​

Range | null

Implementation of ​

Series.valueExtent