Skip to content

Documentation / @finchart/core / index / PriceLineDecoration

Interface: PriceLineDecoration ​

Defined in: packages/core/src/extensions/standard.ts:63

A price line whose options can move after it is mounted — the "last price" line follows every tick through applyOptions({ value }), one registration for the life of the chart, instead of a remove/add pair per tick. The line and its axis badge read one current state, so a change reaches both together and a refused change reaches neither. The decoration does not know its plot: after a change, plot.requestRender() is the caller's — the same contract as crosshairLine.applyOptions.

Extends ​

Methods ​

applyOptions() ​

applyOptions(patch): void

Defined in: packages/core/src/extensions/standard.ts:77

Changes only the given fields; an explicit undefined clears one. The merge is one level deep, so a style in the patch replaces the whole style ({ style: { width: 2 } } drops an earlier custom color) — the same rule as crosshairLine.applyOptions. The merged result is what is checked.

Parameters ​

patch ​

Partial<PriceLineOptions>

Returns ​

void


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 ​

PaneDecorationContext

Returns ​

AxisBadge[]

Inherited from ​

PaneDecoration.axisBadges


draw() ​

draw(target, context): void

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

Parameters ​

target ​

DrawTarget

context ​

PaneDecorationContext

Returns ​

void

Inherited from ​

PaneDecoration.draw


setOptions() ​

setOptions(next): void

Defined in: packages/core/src/extensions/standard.ts:70

Replaces the options wholesale — a snapshot, the way React props are. The candidate is checked first; a refused one leaves the current state as it was. The snapshot is one level deep: style stays the caller's object.

Parameters ​

next ​

PriceLineOptions

Returns ​

void