Skip to content

charton API


charton API / @chart-on/core / index / PointSeries

Class: PointSeries ​

Defined in: packages/core/src/points.ts:120

Markers at exact times and prices, drawn as GPU instances in one call: large trades, liquidations, sampled ticks, signal clouds. Items may share a time and keep the order given.

Extends ​

Constructors ​

Constructor ​

new PointSeries(host, pane, options): PointSeries

Defined in: packages/core/src/series.ts:330

Parameters ​

host ​

SeriesHost

pane ​

Pane

The pane the series draws in; change it with chart.moveSeries.

options ​

PointSeriesOptions

Returns ​

PointSeries

Inherited from ​

Series.constructor

Properties ​

batch ​

readonly batch: RectBatch

Defined in: packages/core/src/points.ts:123


data ​

data: PointItem[] = []

Defined in: packages/core/src/points.ts:122


front ​

protected front: FrontChange = NO_FRONT_CHANGE

Defined in: packages/core/src/series.ts:324

How the latest history page changed the front of the data, for prependAligned.

Inherited from ​

Series.front


host ​

protected readonly host: SeriesHost

Defined in: packages/core/src/series.ts:331

Inherited from ​

Series.host


id ​

readonly id: string

Defined in: packages/core/src/series.ts:314

Inherited from ​

Series.id


kind ​

readonly kind: "points" = 'points'

Defined in: packages/core/src/points.ts:121

Overrides ​

Series.kind


options ​

options: PointSeriesOptions

Defined in: packages/core/src/series.ts:317

Inherited from ​

Series.options


overlayScale ​

overlayScale: PriceScale | null = null

Defined in: packages/core/src/series.ts:320

Own price scale when the series is an overlay; otherwise the pane scale is used.

Inherited from ​

Series.overlayScale


pane ​

pane: Pane

Defined in: packages/core/src/series.ts:333

The pane the series draws in; change it with chart.moveSeries.

Inherited from ​

Series.pane


rangeBuilder ​

protected readonly rangeBuilder: RangeBuilder

Defined in: packages/core/src/series.ts:322

Reused by priceRange so autoscale makes no RangeBuilder per frame.

Inherited from ​

Series.rangeBuilder


visible ​

visible: boolean = true

Defined in: packages/core/src/series.ts:316

Inherited from ​

Series.visible

Accessors ​

drawsOnGpu ​

Get Signature ​

get drawsOnGpu(): boolean

Defined in: packages/core/src/points.ts:319

Internal

Drawn on the GPU canvas, which sits below every series drawn in 2D.

Returns ​

boolean

Overrides ​

Series.drawsOnGpu


hasCrosshairMarker ​

Get Signature ​

get hasCrosshairMarker(): boolean

Defined in: packages/core/src/series.ts:580

Internal

Whether drawCrosshair2D draws anything.

Returns ​

boolean

Inherited from ​

Series.hasCrosshairMarker


inAutoscale ​

Get Signature ​

get inAutoscale(): boolean

Defined in: packages/core/src/series.ts:536

False while the autoscale option leaves this series out of the fit.

Returns ​

boolean

Inherited from ​

Series.inAutoscale


locale ​

Get Signature ​

get protected locale(): Localizer

Defined in: packages/core/src/series.ts:405

The chart's number language (the localization option).

Returns ​

Localizer

Inherited from ​

Series.locale


priceFormat ​

Get Signature ​

get priceFormat(): PriceFormatModel | null

Defined in: packages/core/src/series.ts:410

The priceFormat option resolved in the chart's number language, or null when the series has none.

Returns ​

PriceFormatModel | null

Inherited from ​

Series.priceFormat


priceLineByDefault ​

Get Signature ​

get protected priceLineByDefault(): boolean

Defined in: packages/core/src/series.ts:633

Whether the price line is on when the option is unset.

Returns ​

boolean

Inherited from ​

Series.priceLineByDefault


pulse ​

Get Signature ​

get protected pulse(): PulseClock | null

Defined in: packages/core/src/series.ts:390

Internal

The last-point pulse's clock; null on a chart without the lastPointPulse() plugin.

Returns ​

PulseClock | null

Inherited from ​

Series.pulse


scale ​

Get Signature ​

get scale(): PriceScale

Defined in: packages/core/src/series.ts:441

The price scale this series is drawn against.

Returns ​

PriceScale

Inherited from ​

Series.scale


sizeDomain ​

Get Signature ​

get sizeDomain(): [number, number]

Defined in: packages/core/src/points.ts:240

The default sizeBy domain: the data's size range, or [0, 0] without sizes.

Returns ​

[number, number]


zIndex ​

Get Signature ​

get zIndex(): number

Defined in: packages/core/src/series.ts:349

Draw order within the pane among series drawn by the same renderer: a higher value draws on top. GPU series (candles, histograms, heatmaps, lines and areas) always draw below 2D series (curved lines, custom series, anything with renderer: 'canvas'). Equal values keep the usual order (heatmaps, then overlays and volume profiles, then the rest, each in the order added). Changing it only redraws. Default 0.

Returns ​

number

Set Signature ​

set zIndex(value): void

Defined in: packages/core/src/series.ts:353

Parameters ​
value ​

number

Returns ​

void

Inherited from ​

Series.zIndex

Methods ​

appendAligned() ​

appendAligned(): void

Defined in: packages/core/src/points.ts:189

A bar was appended: only points from the bar before it on can move, unless the interval changed.

Returns ​

void

Overrides ​

Series.appendAligned


applyOptions() ​

applyOptions(partial): void

Defined in: packages/core/src/series.ts:360

Parameters ​

partial ​

Partial<O>

Returns ​

void

Inherited from ​

Series.applyOptions


barSpan() ​

barSpan(index): [number, number]

Defined in: packages/core/src/points.ts:343

Items drawn in bar index: positions within half a bar of it.

Parameters ​

index ​

number

Returns ​

[number, number]


diameterOf() ​

diameterOf(i): number

Defined in: packages/core/src/points.ts:245

Diameter of item i, css px.

Parameters ​

i ​

number

Returns ​

number


dispose() ​

dispose(): void

Defined in: packages/core/src/points.ts:315

Release timers, subscriptions and other resources. The chart calls it once when the series leaves it: removeSeries, removing its pane, or destroy.

Returns ​

void

Overrides ​

Series.dispose


draw2D() ​

draw2D(_ctx, _env): void

Defined in: packages/core/src/series.ts:571

Internal

Paint this series' canvas part for the pane.

Parameters ​

_ctx ​

CanvasRenderingContext2D

_env ​

PaneEnv

Returns ​

void

Inherited from ​

Series.draw2D


drawBelow() ​

drawBelow(_ctx, _env): void

Defined in: packages/core/src/series.ts:574

Internal

Paint behind every series and the GPU layer, clipped to the pane, e.g. background shading.

Parameters ​

_ctx ​

CanvasRenderingContext2D

_env ​

PaneEnv

Returns ​

void

Inherited from ​

Series.drawBelow


drawCrosshair2D() ​

drawCrosshair2D(_ctx, _env): void

Defined in: packages/core/src/series.ts:589

Internal

A marker at the crosshair (env.crosshair), on the crosshair layer: it redraws on every crosshair move, draw2D does not.

Parameters ​

_ctx ​

CanvasRenderingContext2D

_env ​

PaneEnv

Returns ​

void

Inherited from ​

Series.drawCrosshair2D


drawGL() ​

drawGL(r, env): void

Defined in: packages/core/src/points.ts:323

Internal

Record this series' GPU draws for the pane.

Parameters ​

r ​

RenderBackend

env ​

PaneEnv

Returns ​

void

Overrides ​

Series.drawGL


firstValueFrom() ​

firstValueFrom(index): number | undefined

Defined in: packages/core/src/points.ts:296

First value at or after logical index: the base of percent and indexed scales. field asks for the bar's open; series without one give their value.

Parameters ​

index ​

number

Returns ​

number | undefined

Overrides ​

Series.firstValueFrom


fitRange() ​

fitRange(from, to): [number, number] | null

Defined in: packages/core/src/series.ts:545

The range this series adds to its scale's autoscale: priceRange passed through the autoscale option. A throwing function is reported once and the series fits its values meanwhile; a non-finite result adds nothing.

Parameters ​

from ​

number

to ​

number

Returns ​

[number, number] | null

Inherited from ​

Series.fitRange


followMain() ​

followMain(_bars, _kind, _added?): void

Defined in: packages/core/src/series.ts:488

Re-derive the data from the main bars when the series has a follow option. On 'prepend', added is the number of bars that now lead bars.

Parameters ​

_bars ​

readonly Bar[]

_kind ​

FollowKind

_added? ​

number

Returns ​

void

Inherited from ​

Series.followMain


formatValue() ​

formatValue(value): string

Defined in: packages/core/src/series.ts:431

Label text for a value: priceFormat when set, else a format option you passed, else the pane scale's format (see scaleFormat) for a series on that scale, else compact.

Parameters ​

value ​

number

Returns ​

string

Inherited from ​

Series.formatValue


itemAt() ​

itemAt(x, y, view, slop?): number

Defined in: packages/core/src/points.ts:272

Data index of the marker under css point (x, y), the nearest when several are, or -1. A marker counts within its radius plus slop px; on a tie the later item, drawn on top, wins.

Parameters ​

x ​

number

y ​

number

view ​
indexToX ​
priceToY ​
xToIndex ​
slop? ​

number = 3

Returns ​

number


labelValueAt() ​

protected labelValueAt(i): LastValue | null

Defined in: packages/core/src/points.ts:371

The label value of data item i, ignoring lastValueLabel; for the price line.

Parameters ​

i ​

number

Returns ​

LastValue | null

Overrides ​

Series.labelValueAt


lastIndexAtOrBefore() ​

lastIndexAtOrBefore(index): number

Defined in: packages/core/src/points.ts:376

Internal

Data index of the newest item at or before logical index on the time axis (Infinity: the newest item), or -1.

Parameters ​

index ​

number

Returns ​

number

Overrides ​

Series.lastIndexAtOrBefore


lastValue() ​

lastValue(): LastValue | null

Defined in: packages/core/src/series.ts:605

The newest value's price-axis label while lastValueLabel is on.

Returns ​

LastValue | null

Inherited from ​

Series.lastValue


lastValues() ​

lastValues(): LastValue[]

Defined in: packages/core/src/series.ts:610

Price-axis labels for the newest values; series with several outputs return several.

Returns ​

LastValue[]

Inherited from ​

Series.lastValues


legend() ​

legend(index): LegendEntry

Defined in: packages/core/src/points.ts:356

The newest point in the bar under the crosshair, and the bar's point count.

Parameters ​

index ​

number

Returns ​

LegendEntry

Overrides ​

Series.legend


positionOf() ​

positionOf(i): number

Defined in: packages/core/src/points.ts:263

Timeline index of item i (fractional: items keep their exact time).

Parameters ​

i ​

number

Returns ​

number


prependAligned() ​

prependAligned(_bars): void

Defined in: packages/core/src/series.ts:512

The main series gained bars older bars at the front of the timeline (a history page), so every timeline index grew by bars. Series with an incremental path shift their alignment and align and write only the new items; others realign fully.

Parameters ​

_bars ​

number

Returns ​

void

Inherited from ​

Series.prependAligned


priceLine() ​

priceLine(visibleTo): SeriesPriceLine | null

Defined in: packages/core/src/series.ts:638

Where this series' price line sits, given the newest visible logical index; null when it is off.

Parameters ​

visibleTo ​

number

Returns ​

SeriesPriceLine | null

Inherited from ​

Series.priceLine


priceLines() ​

priceLines(visibleTo): SeriesPriceLine[]

Defined in: packages/core/src/series.ts:647

Internal

The price lines drawn this frame: the series' own, or one per plot for an indicator.

Parameters ​

visibleTo ​

number

Returns ​

SeriesPriceLine[]

Inherited from ​

Series.priceLines


priceRange() ​

priceRange(from, to, positiveOnly?): [number, number] | null

Defined in: packages/core/src/points.ts:301

Min/max over visible logical indices for autoscale, or null. With positiveOnly (the default on a log scale) values at or below zero are left out.

Parameters ​

from ​

number

to ​

number

positiveOnly? ​

boolean = ...

Returns ​

[number, number] | null

Overrides ​

Series.priceRange


pulseFor() ​

protected pulseFor(option): PulseClock | null

Defined in: packages/core/src/series.ts:396

Internal

The clock to draw pulse option with; null without the plugin, which development builds say once.

Parameters ​

option ​

LastPointPulse | undefined

Returns ​

PulseClock | null

Inherited from ​

Series.pulseFor


realign() ​

realign(): void

Defined in: packages/core/src/series.ts:494

Recompute timeline indices after main data changes.

Returns ​

void

Inherited from ​

Series.realign


rebuild() ​

rebuild(): void

Defined in: packages/core/src/points.ts:172

Rebuild GPU/CPU caches from data, options and theme.

Returns ​

void

Overrides ​

Series.rebuild


refollow() ​

protected refollow(): void

Defined in: packages/core/src/series.ts:491

The follow option changed: map the main bars again, or drop the derived points when it was removed.

Returns ​

void

Inherited from ​

Series.refollow


setData() ​

setData(items, options?): void

Defined in: packages/core/src/points.ts:133

Parameters ​

items ​

PointItem[]

options? ​

SetDataOptions = {}

Returns ​

void


setVisible() ​

setVisible(visible): void

Defined in: packages/core/src/series.ts:477

Parameters ​

visible ​

boolean

Returns ​

void

Inherited from ​

Series.setVisible


span() ​

span(from, to): [number, number]

Defined in: packages/core/src/points.ts:257

Items [a, b) whose positions lie in [from, to].

Parameters ​

from ​

number

to ​

number

Returns ​

[number, number]


step() ​

step(_dt): boolean

Defined in: packages/core/src/series.ts:446

Advance per-series animations by dt ms; true while still animating.

Parameters ​

_dt ​

number

Returns ​

boolean

Inherited from ​

Series.step


stepOverlay() ​

stepOverlay(_dt): boolean

Defined in: packages/core/src/series.ts:455

Advance animations drawn only on the overlay (such as the last-point pulse) by dt ms, after the frame drew; true when the overlay needs another frame.

Parameters ​

_dt ​

number

Returns ​

boolean

Inherited from ​

Series.stepOverlay


update() ​

update(item): void

Defined in: packages/core/src/points.ts:154

Add a point at or after the newest one's time; an older one is dropped (data:dropped).

Parameters ​

item ​

PointItem

Returns ​

void


valuesInBar() ​

valuesInBar(time): { count: number; value: number; } | null

Defined in: packages/core/src/points.ts:350

Raw values of the bar at time: its newest point's value and its point count; null without points.

Parameters ​

time ​

number

Returns ​

{ count: number; value: number; } | null