Documentation / @finchart/core / index / Series
Interface: Series<T>
Defined in: packages/core/src/series/types.ts:114
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.
Type Parameters
T
T extends BaseDataPoint = BaseDataPoint
Properties
barBody?
readonlyoptionalbarBody?:boolean
Defined in: packages/core/src/series/types.ts:166
Whether each point is drawn as a body one bar slot wide — a candle, a bar, a histogram column. A fit pads the chart by half a bar at each end when any series says so, so the end bodies are drawn whole; a chart of lines alone fits edge to edge.
coordinates?
readonlyoptionalcoordinates?:CoordinateAccessor<T>
Defined in: packages/core/src/series/types.ts:144
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.
decimation?
readonlyoptionaldecimation?:DecimationPolicy<T>
Defined in: packages/core/src/series/types.ts:136
The decimation policy fit for this representation. Omitted means wiring decides — this is a series's third responsibility. A candle can't be thinned, only aggregated (thinning loses the interval's high and low); one per pixel is the ceiling. A registration can override this (SeriesRegistration.decimation).
Methods
describe()?
optionaldescribe(point): readonlySeriesRow[]
Defined in: packages/core/src/series/types.ts:158
The rows a tooltip or legend shows for one of its points — a candle says O/H/L/C and, when the bar has one, V; a line says nothing here and the consumer shows its one value — leaving this out, or returning [], both mean "nothing to say". Called on every probe — a crosshair move, every tooltip and legend refresh, and the magnet crosshair's own draw, twice a frame — for every registration on the pane, so it must be cheap and pure. The point is the one held for drawing — the series' own T, after any derivation — not a pixel-aggregated candle. Values are numbers; how they read is the consumer's formatter, row by row. This is the series' answer only — a registration cannot override it.
Parameters
point
T
Returns
readonly SeriesRow[]
draw()
draw(
target,context):void
Defined in: packages/core/src/series/types.ts:127
Parameters
target
context
Returns
void
valueExtent()
valueExtent(
data):Range|null
Defined in: packages/core/src/series/types.ts:125
The range this representation occupies on the y axis. A line is a single point, so min === max, but a candle occupies a low-to-high span — that can't be expressed as a single number, so it returns a Range.
null when there's nothing to measure — returning { min: 0, max: 0 } would let a series whose data hasn't arrived yet drag the value axis down to 0.
Parameters
data
DataView<T>
Returns
Range | null