Skip to content

charton API


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

Interface: PluginContext ​

Defined in: packages/core/src/plugins.ts:38

What a plugin's install gets: the chart's registration calls, remembered so uninstall can undo them.

Properties ​

chart ​

readonly chart: Chart

Defined in: packages/core/src/plugins.ts:39


coreVersion ​

readonly coreVersion: string

Defined in: packages/core/src/plugins.ts:40

Methods ​

addCustomSeries() ​

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

Defined in: packages/core/src/plugins.ts:46

Add a custom series, removed on uninstall.

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>


attachPrimitive() ​

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

Defined in: packages/core/src/plugins.ts:52

Attach a primitive, detached on uninstall. Returns a function that detaches it earlier.

Parameters ​

primitive ​

Primitive

target? ​

PrimitiveTarget

Returns ​

() => void


host() ​

host<T>(name): T | undefined

Defined in: packages/core/src/plugins.ts:61

What a layer above the chart offers plugins under name, e.g. 'shell' for the UI package's shell (see its shellOf); undefined when absent.

Type Parameters ​

T ​

T

Parameters ​

name ​

string

Returns ​

T | undefined


onDispose() ​

onDispose(fn): void

Defined in: packages/core/src/plugins.ts:56

Run fn on uninstall.

Parameters ​

fn ​

() => void

Returns ​

void


onFrame() ​

onFrame(observer): void

Defined in: packages/core/src/plugins.ts:54

Watch the chart's frames, e.g. to time them, until uninstall.

Parameters ​

observer ​

FrameObserver

Returns ​

void


registerDrawingTool() ​

registerDrawingTool(def): void

Defined in: packages/core/src/plugins.ts:42

Add a drawing tool; one with the same type is replaced while the plugin is installed.

Parameters ​

def ​

DrawingToolDef

Returns ​

void


registerIndicator() ​

registerIndicator<I>(def): void

Defined in: packages/core/src/plugins.ts:44

Register an indicator definition, as chart.indicators.register does.

Type Parameters ​

I ​

I extends Record<string, InputValue>

Parameters ​

def ​

IndicatorDef<I>

Returns ​

void