charton API / @chart-on/core / index / SessionBands
Interface: SessionBands
Defined in: packages/core/src/session-bands.ts:83
A session bands primitive; attach it with chart.attachPrimitive.
Extends
Properties
lanes
readonlylanes: readonlySessionLane[]
Defined in: packages/core/src/session-bands.ts:86
The lanes, top to bottom.
layer?
optionallayer?:PrimitiveLayer
Defined in: packages/core/src/primitives.ts:81
Plot layer (default 'normal'): under the series, with them, or above drawings.
Inherited from
options
readonlyoptions:Readonly<SessionBandsOptions>
Defined in: packages/core/src/session-bands.ts:84
Methods
addLane()
addLane(
lane):void
Defined in: packages/core/src/session-bands.ts:90
Add a lane at the bottom. Throws on a duplicate id, an unknown timezone or malformed hours.
Parameters
lane
Returns
void
applyOptions()
applyOptions(
options):void
Defined in: packages/core/src/session-bands.ts:88
Merge new options and redraw.
Parameters
options
Partial<SessionBandsOptions>
Returns
void
attached()?
optionalattached(host):void
Defined in: packages/core/src/primitives.ts:82
Parameters
host
Returns
void
Inherited from
detached()?
optionaldetached():void
Defined in: packages/core/src/primitives.ts:83
Returns
void
Inherited from
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
Inherited from
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
Inherited from
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
Inherited from
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
Inherited from
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
Inherited from
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
Inherited from
on()
on<
K>(event,listener): () =>void
Defined in: packages/core/src/session-bands.ts:100
Subscribe; returns an unsubscribe function.
Type Parameters
K
K extends "lanes:change"
Parameters
event
K
listener
(payload) => void
Returns
() => void
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
Inherited from
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
Inherited from
removeLane()
removeLane(
id):boolean
Defined in: packages/core/src/session-bands.ts:94
Remove a lane; false when there was none with that id.
Parameters
id
string
Returns
boolean
setLanes()
setLanes(
lanes):void
Defined in: packages/core/src/session-bands.ts:96
Replace every lane. Validates all of them first, so an invalid list changes nothing.
Parameters
lanes
readonly SessionLane[]
Returns
void
states()
states(
now?):SessionLaneState[]
Defined in: packages/core/src/session-bands.ts:98
Each lane's state at now (unix seconds, default the current time), in lane order.
Parameters
now?
number
Returns
updateLane()
updateLane(
id,patch):void
Defined in: packages/core/src/session-bands.ts:92
Change a lane, e.g. its colour. Throws when the id is unknown or the result is invalid.
Parameters
id
string
patch
Partial<Omit<SessionLane, "id">>
Returns
void