Skip to content

Documentation / @finchart/core / index / CrosshairLine

Interface: CrosshairLine ​

Defined in: packages/core/src/extensions/crosshair.ts:73

A crosshair that follows the cursor. It holds its own state — the cursor position comes from input, not render, so it doesn't arrive via context. Something outside has to feed it via follow() and tell Plot to redraw. If you don't want to wire that up yourself every time, use the crosshair() plugin.

Extends ​

Methods ​

applyOptions() ​

applyOptions(patch): void

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

Changes only the given fields — doesn't rebuild. See ConfigurablePluginApi.

Parameters ​

patch ​

Partial<CrosshairLineOptions>

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 ​

PlotDecorationContext

Returns ​

AxisBadge[]

Inherited from ​

PlotDecoration.axisBadges


draw() ​

draw(target, context): void

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

Parameters ​

target ​

DrawTarget

context ​

PlotDecorationContext

Returns ​

void

Inherited from ​

PlotDecoration.draw


follow() ​

follow(position): void

Defined in: packages/core/src/extensions/crosshair.ts:75

Feeds it the cursor position. null when it's left the margin.

Parameters ​

position ​

Point | null

Returns ​

void