Skip to content

Documentation / @finchart/core / index / crosshair

Function: crosshair() ​

crosshair(options?): Plugin<DecorationHost & RenderRequester & PlotEventSource, ConfigurablePluginApi<CrosshairLineOptions>>

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

A plugin that mounts a crosshair and feeds it the cursor.

ts
const cursor = plot.use(crosshair({ horizontal: false }));
cursor.dispose();          // remove it by hand, or
plot.destroy();            // let Plot remove it for you

Why the decoration isn't left to subscribe to events on its own: that would make the decoration need to know about Plot, growing its contract from just draw into a whole lifecycle. Keeping the wiring outside keeps the contract thin.

Parameters ​

options? ​

CrosshairLineOptions & DecorationOptions = {}

Returns ​

Plugin<DecorationHost & RenderRequester & PlotEventSource, ConfigurablePluginApi<CrosshairLineOptions>>