Skip to content

charton API


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

Class: Chart ​

Defined in: packages/core/src/chart.ts:1340

A chart in a container element: panes, series, scales, axes, crosshair, drawings, indicators and data loading. Create one with createChart; the chart owns its canvases, so call destroy() when the container goes away.

Implements ​

  • SeriesHost

Constructors ​

Constructor ​

new Chart(container, __namedParameters?): Chart

Defined in: packages/core/src/chart.ts:1670

Parameters ​

container ​

HTMLElement

__namedParameters? ​

ChartOptionsPatch = {}

Returns ​

Chart

Properties ​

actions ​

readonly actions: ActionRegistry

Defined in: packages/core/src/chart.ts:1344

Built-in and app commands by id, and the keyboard shortcuts that run them.


crosshair ​

crosshair: Point & object | null = null

Defined in: packages/core/src/chart.ts:1380


dpr ​

dpr: number = 1

Defined in: packages/core/src/chart.ts:1379


height ​

height: number = 0

Defined in: packages/core/src/chart.ts:1378


history ​

readonly history: History

Defined in: packages/core/src/chart.ts:1351

The undo history of drawings and indicators: undo(), redo(), canUndo, canRedo and clear(). history:change reports changes. Only the drawings and indicators plugins make steps: without them there is nothing to undo.


options ​

options: ChartOptions

Defined in: packages/core/src/chart.ts:1369


panes ​

readonly panes: Pane[] = []

Defined in: packages/core/src/chart.ts:1368


plotHeight ​

plotHeight: number = 0

Defined in: packages/core/src/chart.ts:1376


plotLeft ​

plotLeft: number = 0

Defined in: packages/core/src/chart.ts:1375

Width of the left axis columns and lanes: the plot's left edge in chart-root css px.


plotWidth ​

plotWidth: number = 0

Defined in: packages/core/src/chart.ts:1373

Plot area size (css px), excludes axes.


root ​

readonly root: HTMLDivElement

Defined in: packages/core/src/chart.ts:1341


theme ​

theme: ChartTheme

Defined in: packages/core/src/chart.ts:1370

Implementation of ​

SeriesHost.theme


time ​

readonly time: TimeScale

Defined in: packages/core/src/chart.ts:1367


timeline ​

readonly timeline: Timeline

Defined in: packages/core/src/chart.ts:1342

Implementation of ​

SeriesHost.timeline


width ​

width: number = 0

Defined in: packages/core/src/chart.ts:1377

Accessors ​

animationsOff ​

Get Signature ​

get animationsOff(): boolean

Defined in: packages/core/src/chart.ts:3942

Internal

Static charts (interactive: false) and low-power mode show no animations; read by series.

Returns ​

boolean

Implementation of ​

SeriesHost.animationsOff


annotationLayer ​

Get Signature ​

get annotationLayer(): AnnotationManager | null

Defined in: packages/core/src/chart.ts:3780

Internal

The annotation manager, or null on a chart without the annotations plugin.

Returns ​

AnnotationManager | null


annotations ​

Get Signature ​

get annotations(): AnnotationManager

Defined in: packages/core/src/chart.ts:3775

Annotations: bar markers, price, trade, alert and draft lines, trade fills (with trading()), zones, bands and labels, and where the data source's marks and indicator shape plots draw. Needs the annotations() plugin (or builtins()); throws a not-registered ChartError without one.

Returns ​

AnnotationManager


barSpacing ​

Get Signature ​

get barSpacing(): number

Defined in: packages/core/src/chart.ts:3412

Pixel width of one bar slot (css px).

Returns ​

number


buckets ​

Get Signature ​

get buckets(): Buckets | null

Defined in: packages/core/src/chart.ts:3130

Internal

How the view groups bars into buckets now, or null when it draws single bars (always without the grouping() plugin). Read by the series every frame.

Returns ​

Buckets | null

Implementation of ​

SeriesHost.buckets


compared ​

Get Signature ​

get compared(): readonly ComparedSymbol[]

Defined in: packages/core/src/chart.ts:2626

Compared symbols, in the order they were added; empty without the comparisons() plugin.

Returns ​

readonly ComparedSymbol[]


crosshairCursor ​

Get Signature ​

get crosshairCursor(): "cross" | "pointer"

Defined in: packages/core/src/chart.ts:4375

Internal

The crosshair.cursor in effect: the crosshair lines while a drawing tool is armed. Read by Interaction for the pointer.

Returns ​

"cross" | "pointer"


crosshairLocked ​

Get Signature ​

get crosshairLocked(): boolean

Defined in: packages/core/src/chart.ts:4342

Whether lockCrosshair holds the crosshair.

Returns ​

boolean


data ​

Get Signature ​

get data(): DataController | null

Defined in: packages/core/src/chart.ts:2672

The data source controller: current symbol, interval and loading state. Null without a source (see setDataSource).

Returns ​

DataController | null


drawingLayer ​

Get Signature ​

get drawingLayer(): DrawingManager | null

Defined in: packages/core/src/chart.ts:3760

Internal

The drawing manager, or null on a chart without a drawings plugin.

Returns ​

DrawingManager | null


drawings ​

Get Signature ​

get drawings(): DrawingManager

Defined in: packages/core/src/chart.ts:3755

Drawings: the drawing manager, with the tools, selection, undo history and saved drawings. Needs the drawingTools() plugin (or drawings(), or builtins()); throws a not-registered ChartError without one.

Returns ​

DrawingManager


features ​

Get Signature ​

get features(): Readonly<ChartFeatures>

Defined in: packages/core/src/chart.ts:1958

Current feature flags; change them with applyOptions({ features }).

Returns ​

Readonly<ChartFeatures>


frameStats ​

Get Signature ​

get frameStats(): RenderStats | null

Defined in: packages/core/src/chart.ts:1936

What the last frame cost, while the renderStats or renderStatsOverlay option is on; null while both are off, before the first frame, or without the statsOverlay() plugin. See also the frame:render event.

Returns ​

RenderStats | null


frameTime ​

Get Signature ​

get frameTime(): number | null

Defined in: packages/core/src/chart.ts:1948

Smoothed time in ms between animation frames that ran back to back (during pans, zooms, easing or live updates), or null before any did. Measured from the frame timestamps the browser hands the chart, so it costs no clock reads and works with renderStats off. A value well above the screen's refresh interval means the machine cannot keep up; see lowPower and the frame:slow event.

Returns ​

number | null


grouping ​

Get Signature ​

get grouping(): GroupingState | null

Defined in: packages/core/src/chart.ts:3164

How the view groups bars now, or null when it draws single bars (always without the grouping() plugin).

Returns ​

GroupingState | null


groupLevel ​

Get Signature ​

get groupLevel(): number

Defined in: packages/core/src/chart.ts:3111

Internal

Pixel grouping: bars per bucket as 2 ** groupLevel; 0 without pixel grouping or while single bars are at least two device pixels wide.

Returns ​

number


groupLevels ​

Get Signature ​

get groupLevels(): SeriesLevels | null

Defined in: packages/core/src/chart.ts:3135

Internal

What series group bars with (SeriesHost.groupLevels); null without the grouping() plugin.

Returns ​

SeriesLevels | null

Implementation of ​

SeriesHost.groupLevels


indicatorLayer ​

Get Signature ​

get indicatorLayer(): IndicatorManager | null

Defined in: packages/core/src/chart.ts:3794

Internal

The indicator manager, or null on a chart without the indicators plugin.

Returns ​

IndicatorManager | null


indicators ​

Get Signature ​

get indicators(): IndicatorManager

Defined in: packages/core/src/chart.ts:3789

Indicator definitions and the indicators on the chart. Needs the indicators() plugin (or builtins()); throws a not-registeredChartError without it.

Returns ​

IndicatorManager


inspecting ​

Get Signature ​

get inspecting(): boolean

Defined in: packages/core/src/chart.ts:4337

Whether a touch long-press drives the crosshair (see touchInspect), including the crosshair it keeps after the finger lifts with 'tap'. A plain touch also moves the crosshair while it pans; this tells the two apart, e.g. to show a pointer tooltip only while inspecting.

Returns ​

boolean


installedPlugins ​

Get Signature ​

get installedPlugins(): string[]

Defined in: packages/core/src/chart.ts:2463

Names of the installed plugins, in install order.

Returns ​

string[]


layoutLoading ​

Get Signature ​

get layoutLoading(): boolean

Defined in: packages/core/src/chart.ts:1878

True from loadLayout until its ready settles. Saving meanwhile would store the layout half-applied (e.g. the old visible range), so state:change waits for it.

Returns ​

boolean


legendSettings ​

Get Signature ​

get legendSettings(): LegendSettings

Defined in: packages/core/src/chart.ts:6768

The resolved legend settings (the object form of the legend option).

Returns ​

LegendSettings


localization ​

Get Signature ​

get localization(): Localizer

Defined in: packages/core/src/chart.ts:2993

Numbers, dates and built-in text in the language of the localization option, e.g. chart.localization.number(1234.5, 2) or chart.localization.text('statusLoading'). Replaced by a new object when the option changes (localization:change). Without the localization() plugin, always englishLocalizer.

Returns ​

Localizer

Implementation of ​

SeriesHost.localization


lowPower ​

Get Signature ​

get lowPower(): boolean

Defined in: packages/core/src/chart.ts:3947

Internal

Low-power mode is on; series drop tweens and costly sampling.

Returns ​

boolean

Implementation of ​

SeriesHost.lowPower


main ​

Get Signature ​

get main(): CandleSeries | null

Defined in: packages/core/src/chart.ts:3933

Returns ​

CandleSeries | null


mainBars ​

Get Signature ​

get mainBars(): readonly Bar[]

Defined in: packages/core/src/chart.ts:3937

The main series' bars, for series that follow them; empty without a main series.

Returns ​

readonly Bar[]

Implementation of ​

SeriesHost.mainBars


maximizedPane ​

Get Signature ​

get maximizedPane(): Pane | null

Defined in: packages/core/src/chart.ts:2004

Returns ​

Pane | null


maxTextureSize ​

Get Signature ​

get maxTextureSize(): number

Defined in: packages/core/src/chart.ts:3925

Returns ​

number

Implementation of ​

SeriesHost.maxTextureSize


plotRect ​

Get Signature ​

get plotRect(): Rect

Defined in: packages/core/src/chart.ts:3564

The plot area (all panes, without the axes) in chart-root css px; empty before layout.

Returns ​

Rect


priceStyles ​

Get Signature ​

get priceStyles(): ((series, release) => PriceStyleDrawer) | null | undefined

Defined in: packages/core/src/chart.ts:2667

Internal

Makes the drawers of the kagi and pointFigure styles (SeriesHost.priceStyles); null without the priceStyles() plugin.

Returns ​

((series, release) => PriceStyleDrawer) | null | undefined

Implementation of ​

SeriesHost.priceStyles


pulse ​

Get Signature ​

get pulse(): ((still) => PulseClock) | null | undefined

Defined in: packages/core/src/chart.ts:2662

Internal

Makes the series' last-point pulse clocks (SeriesHost.pulse); null without the lastPointPulse() plugin.

Returns ​

((still) => PulseClock) | null | undefined

Implementation of ​

SeriesHost.pulse


referenceLines ​

Get Signature ​

get referenceLines(): ReferenceLines

Defined in: packages/core/src/chart.ts:2647

Optional price lines of the main series: previous close, the visible high, low and average close, bid, ask and extended hours. Needs the referenceLines() plugin (or builtins()); throws a not-registeredChartError without it. The referenceLines option is kept for it.

Returns ​

ReferenceLines


replay ​

Get Signature ​

get replay(): Replay

Defined in: packages/core/src/chart.ts:2637

Bar replay of the main series: start(time) hides the bars after time, step, play and pause reveal them, stop shows everything again. Bars from the data source that arrive meanwhile wait hidden. Emits replay:change. Needs the replay() plugin (or builtins()); throws a not-registered ChartError without it.

Returns ​

Replay


sourceMarkers ​

Get Signature ​

get sourceMarkers(): readonly SourceMarker[]

Defined in: packages/core/src/chart.ts:2684

The data source's markers known for the shown symbol and interval, by time, on bars and on the time axis alike (see DataSource.markers); empty when it has none, or while the marks and timeMarks options are both off. Named "source" to set them apart from the app's markers (annotations.getMarkers). The array and its markers are frozen. sourcemarkers:change reports every change.

Returns ​

readonly SourceMarker[]


viewportBounds ​

Get Signature ​

get viewportBounds(): ViewportBounds | null

Defined in: packages/core/src/chart.ts:3081

The bounds set with setViewportBounds, or null.

Returns ​

ViewportBounds | null


watermark ​

Get Signature ​

get watermark(): Watermark

Defined in: packages/core/src/chart.ts:2657

The watermark features.watermark shows: the symbol and interval loaded through the data source. Restyle or retext it with applyOptions. Needs the watermark() plugin (or builtins()); throws a not-registeredChartError without it.

Returns ​

Watermark


zone ​

Get Signature ​

get zone(): Zone

Defined in: packages/core/src/chart.ts:4898

The chart's timezone (from the timezone option); zone.name is the resolved IANA name.

Returns ​

Zone

Methods ​

addCandles() ​

addCandles(options?, pane?): CandleSeries

Defined in: packages/core/src/chart.ts:2123

Parameters ​

options? ​

Partial<CandleSeriesOptions> = {}

pane? ​

Pane = ...

Returns ​

CandleSeries


addCustomSeries() ​

addCustomSeries<D, O>(def, options?, pane?): CustomSeries<D, O>

Defined in: packages/core/src/chart.ts:2171

Add a series of a user-defined chart type (see CustomSeriesDef).

Type Parameters ​

D ​

D extends object

O ​

O extends object

Parameters ​

def ​

CustomSeriesDef<D, O>

options? ​

Partial<O & CustomSeriesBaseOptions<D>> = {}

pane? ​

Pane = ...

Returns ​

CustomSeries<D, O>


addDepthLane() ​

addDepthLane(options?): DepthLane & object

Defined in: packages/core/src/chart.ts:2491

Add a depth lane: bars beside the price axis for bid and ask sizes the app supplies with setLevels and update. It goes on the main pane unless pane is given. remove() on the result detaches it. Needs the depthLane() plugin (or builtins()); throws a not-registeredChartError without it.

Parameters ​

options? ​

Partial<DepthLaneOptions> & object = {}

Returns ​

DepthLane & object


addHeatmap() ​

addHeatmap(options?, pane?): HeatmapSeries

Defined in: packages/core/src/chart.ts:2192

Add a heatmap series. Needs the heatmap() plugin (or builtins()); throws a not-registered ChartError without it, and a webgl-shader one when the heatmap program fails to build.

Parameters ​

options? ​

Partial<HeatmapSeriesOptions> = {}

pane? ​

Pane = ...

Returns ​

HeatmapSeries


addHistogram() ​

addHistogram(options?, pane?): HistogramSeries

Defined in: packages/core/src/chart.ts:2142

Parameters ​

options? ​

Partial<HistogramSeriesOptions> = {}

pane? ​

Pane = ...

Returns ​

HistogramSeries


addLine() ​

addLine(options?, pane?): LineSeries

Defined in: packages/core/src/chart.ts:2156

Parameters ​

options? ​

Partial<LineSeriesOptions> = {}

pane? ​

Pane = ...

Returns ​

LineSeries


addPane() ​

addPane(options?): Pane

Defined in: packages/core/src/chart.ts:1962

Parameters ​

options? ​

Partial<PaneOptions> = {}

Returns ​

Pane


addPoints() ​

addPoints(options?, pane?): PointSeries

Defined in: packages/core/src/chart.ts:2220

Markers at exact times and prices drawn on the GPU, e.g. large trades as bubbles sized by quantity (see PointSeriesOptions.sizeBy). Needs the points() plugin (or builtins()); throws a not-registeredChartError without it.

Parameters ​

options? ​

Partial<PointSeriesOptions> = {}

pane? ​

Pane = ...

Returns ​

PointSeries


addVolumeProfile() ​

addVolumeProfile(options?, pane?): VolumeProfileSeries

Defined in: packages/core/src/chart.ts:2208

Volume-by-price profile of the main candle series: visible range or per session. Needs the volumeProfile() plugin (or builtins()); throws a not-registered ChartError without it.

Parameters ​

options? ​

Partial<VolumeProfileOptions> = {}

pane? ​

Pane = ...

Returns ​

VolumeProfileSeries


announce() ​

announce(text): void

Defined in: packages/core/src/chart.ts:4289

Read text out to screen readers in a polite live region, e.g. when the app finds an alert crossed (see annotations.alertsCrossed). Messages take turns with new-bar announcements, at most one per accessibility.announceIntervalMs; the newest few wait their turn and older ones are dropped.

Parameters ​

text ​

string

Returns ​

void


appearance() ​

appearance(): ChartAppearance

Defined in: packages/core/src/chart.ts:3017

The resolved theme and grid colors, e.g. to show the current values in a settings UI.

Returns ​

ChartAppearance


applyOptions() ​

applyOptions(__namedParameters): void

Defined in: packages/core/src/chart.ts:2885

Parameters ​

__namedParameters ​

ChartOptionsPatch

Returns ​

void


attachPrimitive() ​

attachPrimitive(primitive, target?): () => void

Defined in: packages/core/src/chart.ts:2472

Attach a drawing plugin to a series (it uses the series' scale and is detached with it) or to a pane (default, when neither is given: the main pane). Throws if the pane is not in this chart. Returns a detach function.

Parameters ​

primitive ​

Primitive

target? ​

PrimitiveTarget = {}

Returns ​

() => void


axisScales() ​

axisScales(pane): PriceScale[]

Defined in: packages/core/src/chart.ts:5605

Scales of a pane whose axis shows (see visibleAxes).

Parameters ​

pane ​

Pane

Returns ​

PriceScale[]


captureImage() ​

captureImage(options?): Promise<Blob | null>

Defined in: packages/core/src/chart.ts:4675

The chart as one image: background, GPU series, overlays (drawings, axes, crosshair) and, by default, the legend. At device pixel ratio unless scale asks for another; see ScreenshotOptions for what to include. The app decides where the Blob goes (download, clipboard, upload). Resolves to null when the chart is destroyed or has no size (hidden container), or the GPU context is lost, since the image would be incomplete, or when the browser cannot encode it. Needs the imageCapture() plugin: without it this throws a not-registered ChartError.

Parameters ​

options? ​

ScreenshotOptions = {}

Returns ​

Promise<Blob | null>


clickSelect() ​

clickSelect(p, row): void

Defined in: packages/core/src/chart.ts:2423

Internal

A click on plot point p, or on the legend row of row: select the indicator there, or drop the indicator selection.

Parameters ​

p ​

Point

row ​

Series<object> | null

Returns ​

void


compare() ​

compare(what, options?): ComparedSymbol

Defined in: packages/core/src/chart.ts:2617

Plot symbol next to the main one, loaded and streamed through the data source on the main symbol's interval and history. percent (default) overlays the main pane and switches it to percent mode, so both lines start at 0% at the left edge; scale gives the symbol its own left axis; pane puts it in a new pane. Bars it lacks leave gaps in its line. style draws it as 'candles' or OHLC 'bars' instead of a line, in scale and pane modes; on the main pane they take color. Instead of a symbol, a pair { ratio: [a, b] } or { spread: [a, b], weights? } plots the two symbols combined bar by bar, with gaps where either has no bar; both are loaded and removed together. Needs the comparisons() plugin (or builtins()); throws a not-registeredChartError without it.

Parameters ​

what ​

string | ComparePair

options? ​
color? ​

string

mode? ​

CompareMode

style? ​

CompareStyle

title? ​

string

Returns ​

ComparedSymbol


coordinateFor() ​

coordinateFor(time, price?, pane?): { x: number; y: number | null; } | null

Defined in: packages/core/src/chart.ts:3549

Chart-root css px of a time and price on a pane's primary scale, the position of a bar centre (pointAt snaps x to the nearest bar). y is null without a price. Null before layout, without data, for a missing or hidden pane, and for a price at or below zero on a log scale.

Parameters ​

time ​

number

price? ​

number | null

pane? ​

number = 0

Returns ​

{ x: number; y: number | null; } | null


describe() ​

describe(): string

Defined in: packages/core/src/chart.ts:4246

What the chart shows, in a sentence or two: symbol and interval, the bars in view, the first and last close there with the change, and the high and low. Screen readers get it as the chart's description (see the accessibility option).

Returns ​

string


describeTable() ​

describeTable(options?): HTMLTableElement

Defined in: packages/core/src/chart.ts:4609

The rows of getDataTable as a semantic <table> for assistive technology or a "view as table" panel: a caption, column headers, one row per time with the time (in the chart's timezone and time format) as its row header, and values in each series' own format; empty cells for gaps. Defaults to the visible range. With maxRows, only the newest rows are kept and the caption says so. The table is not attached; the app places and styles it.

Parameters ​

options? ​
from? ​

number

maxRows? ​

number

to? ​

number

Returns ​

HTMLTableElement


destroy() ​

destroy(): void

Defined in: packages/core/src/chart.ts:3646

Release the GPU context, listeners, data subscriptions and DOM. Safe to call twice. Afterwards the chart draws nothing: redraw requests, view changes (scrollToRealtime, fitContent, setVisibleTimeRange, resetView), applyOptions and series removal do nothing, data is null, and calls that load data (setSymbol, compare) reject or throw a ChartError with code 'destroyed', as does a setSymbol still loading.

Returns ​

void


detachPrimitive() ​

detachPrimitive(primitive): void

Defined in: packages/core/src/chart.ts:2480

Parameters ​

primitive ​

Primitive

Returns ​

void


drawingClipboardKey() ​

drawingClipboardKey(e): boolean

Defined in: packages/core/src/chart.ts:3765

Internal

Take a copy, cut or paste shortcut through the drawings plugin's clipboard; false without one.

Parameters ​

e ​

KeyboardEvent

Returns ​

boolean


emit() ​

emit<K>(event, payload): void

Defined in: packages/core/src/chart.ts:4160

Type Parameters ​

K ​

K extends keyof ChartEvents

Parameters ​

event ​

K

payload ​

ChartEvents[K]

Returns ​

void


fitContent() ​

fitContent(animate?): boolean

Defined in: packages/core/src/chart.ts:3184

Fit every bar in view. Bars never get narrower than minBarSpacing (unless grouping is on, which needs the grouping() plugin), so at most plotWidth / minBarSpacing fit: returns false when the view had to be cut short (lower minBarSpacing or turn on grouping to fit more), or there are no bars. Turns autoscale back on, except on scales with a locked price-to-bar ratio.

Parameters ​

animate? ​

boolean = true

Returns ​

boolean


followIndexRange() ​

followIndexRange(from, to): IndexRange | null

Defined in: packages/core/src/chart.ts:3445

Internal

Show logical indices [from, to] at once, like a pan: no animation, and autoscale is left as it is. Returns the range shown after clamping, or null when nothing was moved. Used by link groups.

Parameters ​

from ​

number

to ​

number

Returns ​

IndexRange | null


formatAxis() ​

formatAxis(paneIndex, price, scaleId?): string

Defined in: packages/core/src/chart.ts:4777

Axis label for a price on a pane scale (default the right one): percent change in percent mode, the indexed value in indexed mode, else the price.

Parameters ​

paneIndex ​

number

price ​

number

scaleId? ​

string = 'right'

Returns ​

string


formatPrice() ​

formatPrice(paneIndex, price, decimals?): string

Defined in: packages/core/src/chart.ts:4732

A price on a pane's primary scale (see Pane.primary) as text, in its price format: the first candle series on the scale, else the first series with a priceFormat. Without either, decimals places (compact from 10,000).

Parameters ​

paneIndex ​

number

price ​

number

decimals? ​

number = 2

Returns ​

string


formatTime() ​

formatTime(time): string

Defined in: packages/core/src/chart.ts:4764

Crosshair time label: the formatTime option, else the built-in label in the chart's timezone, following timeAxis.showTime and showSeconds.

Parameters ​

time ​

number

Returns ​

string


getDataTable() ​

getDataTable(range?): DataTable

Defined in: packages/core/src/chart.ts:4574

Rows of time, main OHLCV and every line/histogram/candle series value for [from, to] (inclusive), defaulting to the visible range. Heatmaps are skipped. Candles export their raw bars, whatever the display style. Pass the result to toCSV for a CSV string.

Parameters ​

range? ​
from ​

number

to ​

number

Returns ​

DataTable


getPaneHeights() ​

getPaneHeights(): number[]

Defined in: packages/core/src/chart.ts:2109

Pane stretch weights normalized to sum to 1. Collapsed panes keep the weight they expand back to, so these are not on-screen fractions; pass them to setPaneHeights to restore the layout.

Returns ​

number[]


getPriceRange() ​

getPriceRange(pane?, scale?): { from: number; to: number; } | null

Defined in: packages/core/src/chart.ts:3361

The lowest and highest price a price scale shows (from below to, also on an inverted scale, where from is at the top), in every mode; null when there is no such pane or scale.

Parameters ​

pane? ​

number = 0

scale? ​

string = 'right'

Returns ​

{ from: number; to: number; } | null


getPriceScaleMode() ​

getPriceScaleMode(pane?, scale?): PriceScaleMode

Defined in: packages/core/src/chart.ts:3249

Parameters ​

pane? ​

number = 0

scale? ​

string = 'right'

Returns ​

PriceScaleMode


getPriceScaleOptions() ​

getPriceScaleOptions(pane?, scale?): PriceScaleSettings | null

Defined in: packages/core/src/chart.ts:3384

Parameters ​

pane? ​

number = 0

scale? ​

string = 'right'

Returns ​

PriceScaleSettings | null


getSelection() ​

getSelection(): ChartSelection

Defined in: packages/core/src/chart.ts:2405

What is selected: drawings, one indicator, or null for nothing (always without the drawings and indicators plugins).

Returns ​

ChartSelection


getStatus() ​

getStatus(): ChartStatus | null

Defined in: packages/core/src/chart.ts:4854

The current in-pane status, if any.

Returns ​

ChartStatus | null


getVisibleIndexRange() ​

getVisibleIndexRange(): IndexRange | null

Defined in: packages/core/src/chart.ts:3434

Fractional logical indices at the plot's left and right edges (bar i is centred on index i; past the newest bar they keep counting). Null before layout or without data.

Returns ​

IndexRange | null


getVisibleRange() ​

getVisibleRange(): { from: number; to: number; } | null

Defined in: packages/core/src/chart.ts:3405

Returns ​

{ from: number; to: number; } | null


goToTime() ​

goToTime(time, animate?): Promise<void>

Defined in: packages/core/src/chart.ts:3476

Scroll to time, first paging older history in through the data source until it is loaded (or the source has no more, or 50 pages were fetched), one page per task. Resolves once scrolling has started.

Parameters ​

time ​

number

animate? ​

boolean = true

Returns ​

Promise<void>


gpuMemory() ​

gpuMemory(): GpuMemory

Defined in: packages/core/src/chart.ts:1953

GPU memory the series hold now, in bytes. Available whether or not renderStats is on.

Returns ​

GpuMemory


hasSeriesSettings() ​

hasSeriesSettings(series): boolean

Defined in: packages/core/src/chart.ts:2281

Whether series is on the chart and has settings to open: something listens to series:settings and, once any provider is declared with provideSeriesSettings, one of them covers it. The legend shows a row's settings button, and the row's menu its Settings… item, only then.

Parameters ​

series ​

Series

Returns ​

boolean


hoverPlusButton() ​

hoverPlusButton(p): boolean

Defined in: packages/core/src/chart.ts:6293

Internal

Track whether the pointer is on the "+" button, for its tooltip; returns whether it is. Called by Interaction.

Parameters ​

p ​

Point | null

Returns ​

boolean


indexToX() ​

indexToX(index): number | null

Defined in: packages/core/src/chart.ts:3507

Chart-root x (css px) of a fractional logical index; null before layout or without data.

Parameters ​

index ​

number

Returns ​

number | null


install() ​

install(plugin): () => void

Defined in: packages/core/src/chart.ts:2443

Install a plugin: its install registers drawing tools, indicators, custom series and primitives through the context it gets. Throws a ChartError 'plugin-incompatible' when its requires range excludes CORE_VERSION; an install that throws leaves nothing behind. Returns a function that uninstalls it.

Parameters ​

plugin ​

ChartPlugin

Returns ​

() => void


internals() ​

internals(): ChartInternals

Defined in: packages/core/src/chart.ts:3802

Internal

What the opt-in feature plugins reach of the chart's own members: a new object on each call, for the feature built with it.

Returns ​

ChartInternals


invalidate() ​

invalidate(): void

Defined in: packages/core/src/chart.ts:4099

Redraw everything next frame.

Returns ​

void


invalidateOverlay() ​

invalidateOverlay(): void

Defined in: packages/core/src/chart.ts:4138

Redraw only the overlay (crosshair, drawings, labels) next frame.

Returns ​

void


isAutoScale() ​

isAutoScale(pane?, scale?): boolean

Defined in: packages/core/src/chart.ts:3257

Parameters ​

pane? ​

number = 0

scale? ​

string = 'right'

Returns ​

boolean


isLegendFolded() ​

isLegendFolded(series): boolean

Defined in: packages/core/src/chart.ts:2335

Whether a series' legend row is folded to its title (see setLegendFolded).

Parameters ​

series ​

Series

Returns ​

boolean


labelScale() ​

labelScale(pane, scale): PriceScale

Defined in: packages/core/src/chart.ts:6527

Internal

The axis column a label for scale goes on: its own axis, else the pane's first axis on the main side.

Parameters ​

pane ​

Pane

scale ​

PriceScale

Returns ​

PriceScale


legendSeriesAt() ​

legendSeriesAt(target): Series<object> | null

Defined in: packages/core/src/chart.ts:2340

Internal

The series whose legend row holds target, e.g. a pointer event's target.

Parameters ​

target ​

EventTarget | null

Returns ​

Series<object> | null


listens() ​

listens(event): boolean

Defined in: packages/core/src/chart.ts:4177

Whether anyone listens to event, e.g. so a menu offers "Settings…" only while an app handles series:settings.

Parameters ​

event ​

keyof ChartEvents

Returns ​

boolean


loadLayout() ​

loadLayout(data, options?): LayoutLoadResult

Defined in: packages/core/src/chart.ts:1848

Restore a layout from serializeLayout, e.g. one read from storage. Parts the layout leaves out stay as they are. Older versions are upgraded (see options.migrate). Invalid parts are skipped and listed in errors; the rest loads. Throws, changing nothing, only when data is not a layout or has a version nothing can upgrade. With a data source, the saved symbol loads through it; ready settles once it has. Needs the layouts() plugin (or builtins()); throws a not-registeredChartError without it.

Parameters ​

data ​

unknown

options? ​

LayoutLoadOptions = {}

Returns ​

LayoutLoadResult


lockCrosshair() ​

lockCrosshair(locked): void

Defined in: packages/core/src/chart.ts:4353

Hold the crosshair at its current time and price, so the legend and data window keep showing that bar while the pointer moves on; pan and zoom keep it on its bar. false releases and hides it until the next pointer move. Locking without a visible crosshair does nothing. Alt+click on the plot toggles it, Escape or a touch tap on the plot releases it.

Parameters ​

locked ​

boolean

Returns ​

void


mainDataChanged() ​

mainDataChanged(appended, keepVisibleRange?): void

Defined in: packages/core/src/chart.ts:3951

Main candle series data changed: rebuild the timeline and realign everyone.

Parameters ​

appended ​

boolean

keepVisibleRange? ​

boolean = false

Returns ​

void

Implementation of ​

SeriesHost.mainDataChanged


mainDataPrepended() ​

mainDataPrepended(count): void

Defined in: packages/core/src/chart.ts:3991

The main series gained count older bars in front (a history page). Every timeline index grows by count, which the view needs no change for: its right offset counts from the newest bar. The timeline, series and GPU buffers take just the new bars (and the bar after them); see prependAligned.

Parameters ​

count ​

number

Returns ​

void

Implementation of ​

SeriesHost.mainDataPrepended


mainLastBarChanged() ​

mainLastBarChanged(): void

Defined in: packages/core/src/chart.ts:4028

The main series' last bar was replaced in place (live tick).

Returns ​

void

Implementation of ​

SeriesHost.mainLastBarChanged


marketStatus() ​

marketStatus(now?): MarketStatus & object

Defined in: packages/core/src/chart.ts:4793

Market phase at now (unix seconds, default the current time) from the session and extendedSession options, and the data delay the current symbol reports (0 for realtime). Needs the marketStatus() plugin: without it this throws a not-registered ChartError.

Parameters ​

now? ​

number = ...

Returns ​

MarketStatus & object


maximizePane() ​

maximizePane(pane): void

Defined in: packages/core/src/chart.ts:1998

Give one pane all the height (null restores the others). A hidden pane cannot be maximized.

Parameters ​

pane ​

Pane | null

Returns ​

void


movePane() ​

movePane(pane, index): void

Defined in: packages/core/src/chart.ts:1985

Move a pane to index. The main pane stays first, so index is at least 1.

Parameters ​

pane ​

Pane

index ​

number

Returns ​

void


moveSeparator() ​

moveSeparator(paneIndex, dy): void

Defined in: packages/core/src/chart.ts:4710

Resize two neighbouring panes by moving the separator above paneIndex (hidden panes between them are skipped).

Parameters ​

paneIndex ​

number

dy ​

number

Returns ​

void


moveSeries() ​

moveSeries(series, target): Pane

Defined in: packages/core/src/chart.ts:2049

Move a series to the pane above or below its own, into a new pane after it, or into a given pane. A pane left empty is removed unless it still holds drawings (or is the main pane). The main series stays in the main pane. Moving an indicator's series is an undo step.

Parameters ​

series ​

Series

target ​

Pane | "above" | "below" | "new"

Returns ​

Pane


moveSeriesToFront() ​

moveSeriesToFront(series): void

Defined in: packages/core/src/chart.ts:2028

Draw series above every other series of its pane (sets its zIndex). Uploads nothing.

Parameters ​

series ​

Series

Returns ​

void


notify() ​

notify(notification): void

Defined in: packages/core/src/chart.ts:4834

Tell the user something: emits ui:notify, which the UI package shows as a toast unless a listener calls preventDefault(). Without the UI package nothing is shown; listen to the event to show it yourself. An empty message is ignored.

Parameters ​

notification ​

ChartNotification

Returns ​

void


observeFrames() ​

observeFrames(observer): () => void

Defined in: packages/core/src/chart.ts:5346

Internal

Watch frames with observer (PluginContext.onFrame). Returns a function that stops.

Parameters ​

observer ​

FrameObserver

Returns ​

() => void


on() ​

on<K>(event, listener): () => void

Defined in: packages/core/src/chart.ts:1813

Type Parameters ​

K ​

K extends keyof ChartEvents

Parameters ​

event ​

K

listener ​

(payload) => void

Returns ​

() => void


once() ​

once<K>(event, listener): () => void

Defined in: packages/core/src/chart.ts:1805

Like on, for the next emission only; returns a function that cancels it.

Type Parameters ​

K ​

K extends keyof ChartEvents

Parameters ​

event ​

K

listener ​

(payload) => void

Returns ​

() => void


openContextMenu() ​

openContextMenu(x, y, clientX, clientY): boolean

Defined in: packages/core/src/chart.ts:4520

Emit chart:contextmenu for chart-root css px (like pointAt) when the contextMenu feature is on and something listens. Returns whether it did, so the caller suppresses the browser menu only then.

Parameters ​

x ​

number

y ​

number

clientX ​

number

clientY ​

number

Returns ​

boolean


openLegendMenu() ​

openLegendMenu(series, clientX, clientY): boolean

Defined in: packages/core/src/chart.ts:2348

Internal

Emit chart:contextmenu for a legend row at viewport px, when the contextMenu feature is on and something listens. Returns whether it did.

Parameters ​

series ​

Series

clientX ​

number

clientY ​

number

Returns ​

boolean


openSeriesSettings() ​

openSeriesSettings(series): boolean

Defined in: packages/core/src/chart.ts:2269

Ask the app to show series' settings: emits series:settings, as the legend's settings button does. Returns false, emitting nothing, when the series has no settings (see hasSeriesSettings).

Parameters ​

series ​

Series

Returns ​

boolean


paneBounds() ​

paneBounds(): object[]

Defined in: packages/core/src/chart.ts:3558

Pane tops and heights in chart-root css px; a hidden pane (another one maximized) has height 0.

Returns ​

object[]


paneFormat() ​

paneFormat(paneIndex): PriceFormatModel | null

Defined in: packages/core/src/chart.ts:4755

The price format of a pane's scale (see formatPrice), or null.

Parameters ​

paneIndex ​

number

Returns ​

PriceFormatModel | null


paneIndexAt() ​

paneIndexAt(y): number

Defined in: packages/core/src/chart.ts:4221

Parameters ​

y ​

number

Returns ​

number


plusButtonAt() ​

plusButtonAt(p): boolean

Defined in: packages/core/src/chart.ts:6284

Internal

Whether plot point p is on the "+" button. Called by Interaction.

Parameters ​

p ​

Point

Returns ​

boolean


plusButtonEvent() ​

plusButtonEvent(): PlusButtonEvent | null

Defined in: packages/core/src/chart.ts:6306

Internal

The plus:click payload for the button as it is now, or null when hidden. Called by Interaction on press.

Returns ​

PlusButtonEvent | null


pointAt() ​

pointAt(x, y): ChartPointerEvent | null

Defined in: packages/core/src/chart.ts:4560

Data position under root-relative css px, or null outside the plot areas or without data.

Parameters ​

x ​

number

y ​

number

Returns ​

ChartPointerEvent | null


priceAxisSpace() ​

priceAxisSpace(side): number

Defined in: packages/core/src/chart.ts:3572

Space (css px) all price axis columns on one side take as laid out; 0 for a side without axes. options.priceAxisWidth is the width of one column.

Parameters ​

side ​

"left" | "right"

Returns ​

number


priceToY() ​

priceToY(price, pane?, scale?): number | null

Defined in: packages/core/src/chart.ts:3528

Chart-root y (css px) of price on a pane's scale, by default the primary one that pointAt reads. Null before layout, for a missing or hidden pane or an unknown scale id, and for a price at or below zero on a log scale.

Parameters ​

price ​

number

pane? ​

number = 0

scale? ​

string

Returns ​

number | null


primitiveAt() ​

primitiveAt(p): { hit: PrimitiveHit; primitive: Primitive; } | null

Defined in: packages/core/src/chart.ts:2503

Topmost primitive under a plot point (plot-relative css px: x from the plot's left edge, which left price axes move right) that reports a hit. Primitives on hidden series are ignored. Also drives the hover cursor.

Parameters ​

p ​

Point

Returns ​

{ hit: PrimitiveHit; primitive: Primitive; } | null


provideFeature() ​

provideFeature<K>(key, feature): () => void

Defined in: packages/core/src/chart.ts:3722

Internal

Give the chart the opt-in feature key (see OptInFeatures): a series kind or lane, the data source, drawings, annotations, indicators and the other parts their plugins bring. The plugins in builtins.ts call it; new opt-in parts use it too. Returns a function that takes it back, restoring the feature it replaced.

Type Parameters ​

K ​

K extends keyof OptInFeatures

Parameters ​

key ​

K

feature ​

OptInFeatures[K]

Returns ​

() => void


provideSeriesSettings() ​

provideSeriesSettings(covers): () => void

Defined in: packages/core/src/chart.ts:2294

Declare which rows the app provides settings for: covers gets each series and its indicator (or null) and returns whether a series:settings listener shows something for it. While any provider is declared, only the rows one of them covers get a settings button; with none, every row does while something listens to series:settings. A covers that throws covers nothing, and its error is reported like a listener's (chart:error). Returns a function that withdraws the provider.

Parameters ​

covers ​

(series, indicator) => boolean

Returns ​

() => void


redraw() ​

redraw(reason): void

Defined in: packages/core/src/chart.ts:4107

Internal

Redraw everything next frame, noting reason for the render statistics. The chart's own requests; apps call invalidate.

Parameters ​

reason ​

RedrawReason

Returns ​

void


redrawOverlay() ​

redrawOverlay(reason): void

Defined in: packages/core/src/chart.ts:4146

Internal

Redraw only the overlay next frame, noting reason for the render statistics. The chart's own requests; apps call invalidateOverlay.

Parameters ​

reason ​

RedrawReason

Returns ​

void


regionAt() ​

regionAt(x, y): Region | null

Defined in: packages/core/src/chart.ts:4189

Parameters ​

x ​

number

y ​

number

Returns ​

Region | null


releaseGpu() ​

releaseGpu(owner): void

Defined in: packages/core/src/chart.ts:3929

Free the GPU objects mirroring a batch or grid of a disposed series.

Parameters ​

owner ​

GpuOwner

Returns ​

void

Implementation of ​

SeriesHost.releaseGpu


reload() ​

reload(options?): Promise<void>

Defined in: packages/core/src/chart.ts:2753

Load the current symbol and interval again, bypassing the cache and aborting requests in flight. Shows the newest bars, or with keepView the visible time range. Rejects when loading fails.

Parameters ​

options? ​
keepView? ​

boolean

Returns ​

Promise<void>


removePane() ​

removePane(pane): void

Defined in: packages/core/src/chart.ts:1972

Remove a pane with its series and drawings. The main pane cannot be removed.

Parameters ​

pane ​

Pane

Returns ​

void


removeSeries() ​

removeSeries(series): void

Defined in: packages/core/src/chart.ts:2226

Parameters ​

series ​

Series

Returns ​

void


requestRender() ​

requestRender(): void

Defined in: packages/core/src/chart.ts:4055

Returns ​

void

Implementation of ​

SeriesHost.requestRender


resetView() ​

resetView(animate?): void

Defined in: packages/core/src/chart.ts:3237

Default zoom, newest bar in view, all panes autoscaled.

Parameters ​

animate? ​

boolean = true

Returns ​

void


resize() ​

resize(): void

Defined in: packages/core/src/chart.ts:3598

Re-measure the container and redraw at once. The chart calls it itself when the container's size or the device pixel ratio changes; call it after changes it cannot see, such as a CSS transform or a container shown again while its size stayed the same.

Returns ​

void


roundPrice() ​

roundPrice(paneIndex, price): number

Defined in: packages/core/src/chart.ts:4750

price rounded to the tick size of the pane's price format.

Parameters ​

paneIndex ​

number

price ​

number

Returns ​

number


scrollToRealtime() ​

scrollToRealtime(animate?): void

Defined in: packages/core/src/chart.ts:3053

Scroll to the newest bar keeping the configured right offset.

Parameters ​

animate? ​

boolean = true

Returns ​

void


scrollToTime() ​

scrollToTime(time, animate?): void

Defined in: packages/core/src/chart.ts:3491

Centre time (unix seconds) in the plot at the current bar spacing.

Parameters ​

time ​

number

animate? ​

boolean = true

Returns ​

void


selector() ​

selector(make): void

Defined in: packages/core/src/chart.ts:2432

Internal

The selection, made with make the first time a plugin asks: the drawings and indicators plugins, which bring the code, so a chart without them selects nothing. It stays for the chart's life.

Parameters ​

make ​

(internals) => SelectionFeature

Returns ​

void


sendToBack() ​

sendToBack(series): void

Defined in: packages/core/src/chart.ts:2036

Draw series below every other series of its pane (sets its zIndex). Uploads nothing.

Parameters ​

series ​

Series

Returns ​

void


serializeLayout() ​

serializeLayout(options?): ChartLayout

Defined in: packages/core/src/chart.ts:1834

The layout the user arranged, to store and restore with loadLayout: symbol and interval, chart type, panes with their heights and price scales, indicators, drawings and, with visibleRange: true, the visible time range. Bars are never included. Indicators and drawings added with persist: false are left out. Needs the layouts() plugin (or builtins()); throws a not-registered ChartError without it.

Parameters ​

options? ​

LayoutSerializeOptions = {}

Returns ​

ChartLayout


seriesAt() ​

seriesAt(rootX, y): Series<object> | null

Defined in: packages/core/src/chart.ts:4427

Topmost visible candle, line, histogram, point or indicator series under root-relative css px, or null.

Parameters ​

rootX ​

number

y ​

number

Returns ​

Series<object> | null


seriesDropped() ​

seriesDropped(series, bar, reason): void

Defined in: packages/core/src/chart.ts:4060

A series left out a bar or point in update or setData(..., { normalize: true }).

Parameters ​

series ​

Series

bar ​

unknown

reason ​

DropReason

Returns ​

void

Implementation of ​

SeriesHost.seriesDropped


seriesError() ​

seriesError(event): void

Defined in: packages/core/src/chart.ts:4093

A user-supplied series hook threw; the series already recovered.

Parameters ​

event ​

SeriesErrorEvent

Returns ​

void

Implementation of ​

SeriesHost.seriesError


seriesOptionsChanged() ​

seriesOptionsChanged(series, patch): void

Defined in: packages/core/src/chart.ts:4065

Internal

Parameters ​

series ​

Series

patch ​

object

Returns ​

void

Implementation of ​

SeriesHost.seriesOptionsChanged


seriesVisibilityChanged() ​

seriesVisibilityChanged(series): void

Defined in: packages/core/src/chart.ts:4070

Internal

Parameters ​

series ​

Series

Returns ​

void

Implementation of ​

SeriesHost.seriesVisibilityChanged


setAutoScale() ​

setAutoScale(on, pane?, scale?): void

Defined in: packages/core/src/chart.ts:3261

Parameters ​

on ​

boolean

pane? ​

number = 0

scale? ​

string = 'right'

Returns ​

void


setBarColors() ​

setBarColors(series, at, from): void

Defined in: packages/core/src/chart.ts:4085

Internal

An indicator's bar colour plots changed: recolour the main series' bars.

Parameters ​

series ​

Series

at ​

((i) => string | undefined) | null

from ​

number

Returns ​

void

Implementation of ​

SeriesHost.setBarColors


setBarSpacing() ​

setBarSpacing(px, anchorX?): void

Defined in: packages/core/src/chart.ts:3420

Zoom to px per bar, keeping the bar under chart-root anchorX (default: the plot's right edge) in place. Clamped like a wheel zoom.

Parameters ​

px ​

number

anchorX? ​

number

Returns ​

void


setCrosshair() ​

setCrosshair(point): void

Defined in: packages/core/src/chart.ts:4230

Move the crosshair to a plot point, or hide it; ignored while it is locked.

Parameters ​

point ​

Point & object | null

Returns ​

void


setCrosshairAt() ​

setCrosshairAt(time, price?, pane?): void

Defined in: packages/core/src/chart.ts:4499

Show the crosshair at a time, e.g. to mirror another chart's crosshair:move event. A null price draws only the vertical line; a null time hides it. Does not emit crosshair:move, so two charts mirroring each other cannot loop. The next pointer move over this chart takes over.

Parameters ​

time ​

number | null

price? ​

number | null

pane? ​

number = 0

Returns ​

void


setDataSource() ​

setDataSource(source, options?): void

Defined in: packages/core/src/chart.ts:2516

Load data through source instead of pushing it with setData. Older history then pages in automatically on scroll-back. Pass null to detach. Needs the dataSource() plugin (or builtins()); throws a not-registered ChartError for a source without it.

Parameters ​

source ​

DataSource | null

options? ​

Partial<DataControllerOptions> = {}

Returns ​

void


setLegendFolded() ​

setLegendFolded(series, folded): void

Defined in: packages/core/src/chart.ts:2325

Fold a series' legend row to its title, or unfold it. An indicator's row fires indicator:change and is saved with the indicator (IndicatorState.folded).

Parameters ​

series ​

Series

folded ​

boolean

Returns ​

void


setPaneCollapsed() ​

setPaneCollapsed(pane, collapsed): void

Defined in: packages/core/src/chart.ts:2009

Shrink a pane to a thin header (its legend), or expand it again.

Parameters ​

pane ​

Pane

collapsed ​

boolean

Returns ​

void


setPaneHeights() ​

setPaneHeights(weights): void

Defined in: packages/core/src/chart.ts:2115

Set pane heights from weights (any positive numbers, e.g. saved fractions).

Parameters ​

weights ​

readonly number[]

Returns ​

void


setPaneHidden() ​

setPaneHidden(pane, hidden): void

Defined in: packages/core/src/chart.ts:2020

Hide a pane, giving its height to the others, or show it again. Its series, indicators and drawings stay. The main pane cannot be hidden; hiding the maximized pane restores the others.

Parameters ​

pane ​

Pane

hidden ​

boolean

Returns ​

void


setPlotMarkers() ​

setPlotMarkers(series, markers): void

Defined in: packages/core/src/chart.ts:4075

Internal

An indicator's shape plots changed: draw markers on the bar marker layer.

Parameters ​

series ​

Series

markers ​

BarMarker[]

Returns ​

void

Implementation of ​

SeriesHost.setPlotMarkers


setPluginHost() ​

setPluginHost(name, host): void

Defined in: packages/core/src/chart.ts:2453

Offer host to plugins under name (ctx.host(name) in install), or withdraw it with null. A layer built on the chart, like the UI shell, uses it to let plugins add to it. Plugins installed afterwards see it.

Parameters ​

name ​

string

host ​

unknown

Returns ​

void


setPriceRange() ​

setPriceRange(range, pane?, scale?, animate?): void

Defined in: packages/core/src/chart.ts:3334

Show exactly from to to (prices in every mode, in any order) on a price scale of a pane (default the right one) and turn its autoscale off; animate eases there. Throws a RangeError for equal or non-finite prices, or prices at or below zero on a log scale.

Parameters ​

range ​
from ​

number

to ​

number

pane? ​

number = 0

scale? ​

string = 'right'

animate? ​

boolean = false

Returns ​

void


setPriceScaleMode() ​

setPriceScaleMode(mode, pane?, scale?): void

Defined in: packages/core/src/chart.ts:3253

Parameters ​

mode ​

PriceScaleMode

pane? ​

number = 0

scale? ​

string = 'right'

Returns ​

void


setPriceScaleOptions() ​

setPriceScaleOptions(options, pane?, scale?): void

Defined in: packages/core/src/chart.ts:3270

Change a price scale of a pane (default the right one). Scales are created on first use: give a series priceScale: 'my-scale', then setPriceScaleOptions({ side: 'left' }, 0, 'my-scale') to show its axis.

Parameters ​

options ​

Partial<PriceScaleSettings>

pane? ​

number = 0

scale? ​

string = 'right'

Returns ​

void


setSelection() ​

setSelection(selection): void

Defined in: packages/core/src/chart.ts:2415

Select drawings (as drawings.setSelection does) or an indicator on this chart, which clears the other kind; null clears both. An indicator no longer on the chart selects nothing. Emits selection:change when the selection changed. Does nothing without the drawings and indicators plugins.

Parameters ​

selection ​

ChartSelection

Returns ​

void


setStatus() ​

setStatus(status): void

Defined in: packages/core/src/chart.ts:4806

Show a message in the middle of the plot area, or clear it with null. The data source sets it while loading, for no data, errors and expired contracts. A failed load shows generic text; the data source's error message is in getStatus().detail. The chart never sets unknown-symbol (data sources report every failure the same way): set it from your app, e.g. when your source knows a symbol does not exist.

Parameters ​

status ​

ChartStatus | null

Returns ​

void


setSymbol() ​

setSymbol(symbol, interval): Promise<void>

Defined in: packages/core/src/chart.ts:2715

Load symbol at interval from the data source. Rejects when loading fails.

Parameters ​

symbol ​

string

interval ​

Interval

Returns ​

Promise<void>


setViewportBounds() ​

setViewportBounds(bounds): void

Defined in: packages/core/src/chart.ts:3071

Keep the view inside a time window and a price band, through every pointer, keyboard and programmatic path; null removes the bounds. Panning slides along the edges without zooming, zooming out stops once the window fills the plot, and a price bound turns that scale's autoscale off (back on when cleared). Bounds clear on a symbol or interval change unless keepOnContextChange is set. Throws on bounds that are not finite or out of order. Needs the viewportBounds() plugin (or builtins()); throws a not-registered ChartError without it.

Parameters ​

bounds ​

ViewportBounds | null

Returns ​

void


setVisibleIndexRange() ​

setVisibleIndexRange(from, to, animate?): void

Defined in: packages/core/src/chart.ts:3458

Show logical indices [from, to] edge to edge; fractional values are kept. Clamped like user panning and zooming, so the result can differ near the ends of the data. Turns the main pane's autoscale back on, like setVisibleTimeRange, except on scales with a locked price-to-bar ratio.

Parameters ​

from ​

number

to ​

number

animate? ​

boolean = true

Returns ​

void


setVisibleTimeRange() ​

setVisibleTimeRange(from, to, animate?): boolean

Defined in: packages/core/src/chart.ts:3205

Show the time span [from, to] (unix seconds) across the plot. Returns false when it holds more bars than fit at minBarSpacing (any number fit with grouping on; the view then shows the newest part of it), or nothing could be shown yet. Turns the main pane's autoscale back on, except on scales with a locked price-to-bar ratio.

Parameters ​

from ​

number

to ​

number

animate? ​

boolean = true

Returns ​

boolean


timeToX() ​

timeToX(time): number | null

Defined in: packages/core/src/chart.ts:3502

Chart-root x (css px) of a time, extrapolated past the data; null before layout or without data.

Parameters ​

time ​

number

Returns ​

number | null


undoSteps() ​

undoSteps(make): UndoSteps

Defined in: packages/core/src/chart.ts:3746

Internal

The steps behind history, made with make the first time a plugin asks: the drawings and indicators plugins, which bring the class, so a chart without them leaves it out. They stay for the chart's life.

Parameters ​

make ​

(changed) => UndoSteps

Returns ​

UndoSteps


uninstall() ​

uninstall(name): boolean

Defined in: packages/core/src/chart.ts:2458

Uninstall a plugin by name, removing everything it added; false when none has that name.

Parameters ​

name ​

string

Returns ​

boolean


updateHover() ​

updateHover(p): void

Defined in: packages/core/src/chart.ts:4479

Internal

Track the series under the pointer (plot coordinates) and emit series:hover when it changes. Called by Interaction.

Parameters ​

p ​

Point | null

Returns ​

void


valuesAt() ​

valuesAt(time?): ValuesAt | null

Defined in: packages/core/src/chart.ts:4403

Every series' value at the bar nearest time (default: the crosshair's bar, else the newest), with raw numbers and legend text. Null without data. Hidden panes and panes behind a maximized one are left out, like in the legend.

Parameters ​

time? ​

number

Returns ​

ValuesAt | null


xToIndex() ​

xToIndex(x): number | null

Defined in: packages/core/src/chart.ts:3512

Fractional logical index at chart-root x, the inverse of indexToX.

Parameters ​

x ​

number

Returns ​

number | null


xToTime() ​

xToTime(x): number | null

Defined in: packages/core/src/chart.ts:3517

Time of the bar nearest chart-root x (as pointAt reports it), extrapolated past the data.

Parameters ​

x ​

number

Returns ​

number | null


yToPrice() ​

yToPrice(y, pane?, scale?): number | null

Defined in: packages/core/src/chart.ts:3537

Price at chart-root y, the inverse of priceToY. Without pane, the pane under y is used.

Parameters ​

y ​

number

pane? ​

number

scale? ​

string

Returns ​

number | null