charton API / @chart-on/core / index / Primitive
Interface: Primitive
Defined in: packages/core/src/primitives.ts:79
Plugin that draws on the chart. Every member is optional. Attach with chart.attachPrimitive.
Extended by
Properties
layer?
optionallayer?:PrimitiveLayer
Defined in: packages/core/src/primitives.ts:81
Plot layer (default 'normal'): under the series, with them, or above drawings.
Methods
attached()?
optionalattached(host):void
Defined in: packages/core/src/primitives.ts:82
Parameters
host
Returns
void
detached()?
optionaldetached():void
Defined in: packages/core/src/primitives.ts:83
Returns
void
drawLane()?
optionaldrawLane(ctx,env):void
Defined in: packages/core/src/primitives.ts:99
Draw in the reserved lane (clipped to it); env.width is the lane width.
Parameters
ctx
CanvasRenderingContext2D
env
Returns
void
drawPlot()?
optionaldrawPlot(ctx,env):void
Defined in: packages/core/src/primitives.ts:85
Draw in the pane's plot area (clipped to it).
Parameters
ctx
CanvasRenderingContext2D
env
Returns
void
drawPriceAxis()?
optionaldrawPriceAxis(ctx,env):void
Defined in: packages/core/src/primitives.ts:87
Draw in the pane's price-axis area; env.width is the axis width.
Parameters
ctx
CanvasRenderingContext2D
env
Returns
void
drawTimeAxis()?
optionaldrawTimeAxis(ctx,env):void
Defined in: packages/core/src/primitives.ts:89
Draw in the time-axis area; env.height is the axis height.
Parameters
ctx
CanvasRenderingContext2D
env
Returns
void
hitTest()?
optionalhitTest(p,env):PrimitiveHit|null
Defined in: packages/core/src/primitives.ts:105
Hit test a plot-local point (pane-local css px).
Parameters
p
env
Returns
PrimitiveHit | null
lane()?
optionallane():PrimitiveLane|null
Defined in: packages/core/src/primitives.ts:97
Reserve a lane of this width between the plot and the price axis on one side; null (or no method) takes no width. The plot narrows to make room, so the axis keeps its place and width. Lanes of one pane and side sit side by side in attach order, the first next to the plot. Read on every full redraw: call requestRedraw after the answer changes.
Returns
PrimitiveLane | null
priceAxisLabels()?
optionalpriceAxisLabels(env):PriceAxisLabel[]
Defined in: packages/core/src/primitives.ts:101
Labels drawn on the price axis like last-value labels.
Parameters
env
Returns
priceRange()?
optionalpriceRange(from,to): [number,number] |null
Defined in: packages/core/src/primitives.ts:103
Price span to keep in view over visible indices [from, to].
Parameters
from
number
to
number
Returns
[number, number] | null