Skip to content

charton API


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

Interface: IndicatorSeries ​

Defined in: packages/core/src/indicators/series.ts:114

Draws every plot of one indicator. Outputs are aligned with the main series, so output position k is timeline index k.

Extends ​

Properties ​

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: "indicator" = 'indicator'

Defined in: packages/core/src/indicators/series.ts:115

Overrides ​

Series.kind


options ​

options: IndicatorSeriesOptions

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/series.ts:595

Internal

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

Returns ​

boolean

Inherited from ​

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


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/series.ts:502

The main series gained a bar at the end of the timeline. Series with an incremental path align only their new items; others realign fully.

Returns ​

void

Inherited from ​

Series.appendAligned


applyOptions() ​

applyOptions(partial): void

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

Parameters ​

partial ​

Partial<O>

Returns ​

void

Inherited from ​

Series.applyOptions


dispose() ​

dispose(): void

Defined in: packages/core/src/indicators/series.ts:154

Stop the runner, so a pending async compute cannot redraw a removed series or destroyed chart, and free the histogram, line and fill batches' GPU objects.

Returns ​

void

Overrides ​

Series.dispose


draw2D() ​

draw2D(ctx, env): void

Defined in: packages/core/src/indicators/series.ts:755

Internal

Paint this series' canvas part for the pane.

Parameters ​

ctx ​

CanvasRenderingContext2D

env ​

PaneEnv

Returns ​

void

Overrides ​

Series.draw2D


drawBelow() ​

drawBelow(ctx, env): void

Defined in: packages/core/src/indicators/series.ts:673

Background plots: each bar's (or bucket's) palette colour over the pane's full height, a run of one colour as one rect.

Parameters ​

ctx ​

CanvasRenderingContext2D

env ​

PaneEnv

Returns ​

void

Overrides ​

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/indicators/series.ts:576

Internal

Record this series' GPU draws for the pane.

Parameters ​

r ​

RenderBackend

env ​

PaneEnv

Returns ​

void

Overrides ​

Series.drawGL


firstValueFrom() ​

firstValueFrom(_index, _field?): number | undefined

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

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

_field? ​

"close" | "open"

Returns ​

number | undefined

Inherited from ​

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


hits() ​

hits(index, y): boolean

Defined in: packages/core/src/indicators/series.ts:845

Internal

Whether a shown plot is drawn at timeline index within a few px of pane-relative y: a line near its value (while grouped, anywhere in its bucket's range), a histogram column from its base to its value.

Parameters ​

index ​

number

y ​

number

Returns ​

boolean


labelValueAt() ​

protected labelValueAt(_i): LastValue | null

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

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

Parameters ​

_i ​

number

Returns ​

LastValue | null

Inherited from ​

Series.labelValueAt


lastIndexAtOrBefore() ​

lastIndexAtOrBefore(_index): number

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

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

Inherited from ​

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/indicators/series.ts:937

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

Returns ​

LastValue[]

Overrides ​

Series.lastValues


legend() ​

legend(index): LegendEntry

Defined in: packages/core/src/indicators/series.ts:888

Legend row at logical index; view is the chart's legend mode (candles also read showChange).

Parameters ​

index ​

number

Returns ​

LegendEntry

Overrides ​

Series.legend


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/indicators/series.ts:918

Internal

One price line per shown line, histogram or OHLC plot with priceLine on.

Parameters ​

visibleTo ​

number

Returns ​

SeriesPriceLine[]

Overrides ​

Series.priceLines


priceRange() ​

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

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

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/indicators/series.ts:240

Outputs follow the main series bar for bar; the runner reports changes.

Returns ​

void

Overrides ​

Series.realign


rebuild() ​

rebuild(): void

Defined in: packages/core/src/indicators/series.ts:235

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


refresh() ​

refresh(from): void

Defined in: packages/core/src/indicators/series.ts:243

Re-upload histogram columns for bars [from, length), and mark the line vertices from there stale.

Parameters ​

from ​

number

Returns ​

void


setPlotStyles() ​

setPlotStyles(styles): void

Defined in: packages/core/src/indicators/series.ts:198

Internal

The plot styles set over the definition's; the indicator keeps styles up to date.

Parameters ​

styles ​

Readonly<Record<string, PlotStyle>>

Returns ​

void


setStatus() ​

setStatus(loading, message): void

Defined in: packages/core/src/indicators/series.ts:190

Internal

Loading marker for the legend and a message for the pane (null for none).

Parameters ​

loading ​

boolean

message ​

string | null

Returns ​

void


setVisible() ​

setVisible(visible): void

Defined in: packages/core/src/indicators/series.ts:225

Shown or hidden, the bars' colours follow.

Parameters ​

visible ​

boolean

Returns ​

void

Overrides ​

Series.setVisible


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