Skip to content

Documentation / @finchart/core / index / Decoration

Interface: Decoration<Context> ​

Defined in: packages/core/src/plot/decoration.ts:97

Something drawn on the chart that isn't a representation of data.

There's exactly one line that separates it from a Series — it doesn't participate in value-axis fitting. Register a target line as a series and valueExtent pulls y toward it, flattening the price. A crosshair or a watermark has no value to contribute in the first place.

Context is a type parameter because what each registration site receives differs. Folding it into one type with yScale: Scale | null would force even a decoration that can only ever register on a pane to narrow away a null that never happens.

Type Parameters ​

Context ​

Context

Methods ​

axisBadges()? ​

optional axisBadges(context): AxisBadge[]

Defined in: packages/core/src/plot/decoration.ts:110

Describes something to place on the axis — a crosshair value box, a price-line label.

The reason it's described rather than drawn is layering. When tick labels are DOM, a box drawn on canvas can't cover them — whoever draws the ticks has to draw the badge too, for the overlap to come out right whether the path is DOM or canvas. A badge for an axis that isn't showing labels is dropped — drawing into space that doesn't exist would cover the data instead.

Parameters ​

context ​

Context

Returns ​

AxisBadge[]


draw() ​

draw(target, context): void

Defined in: packages/core/src/plot/decoration.ts:98

Parameters ​

target ​

DrawTarget

context ​

Context

Returns ​

void