Skip to content

Documentation / @finchart/react / usePlot

Function: usePlot() ​

usePlot<T>(__namedParameters): object

Defined in: react/src/hooks/use-chart.ts:102

Attaches the core Plot to a container and fits it to React's lifecycle (principle: React Wrapper).

Creates the Plot once, on mount. Every change after that flows through the imperative API — recreating it would swap the canvas out, dropping the pan position and any overlay annotations.

A low-level escape hatch. This is the hook <ChartContainer> uses internally, and the <ChartContainer>/<ChartSeries> combination is enough for most apps. The only reason to reach for it directly is swapping a single series through an imperative handle (SeriesHandle).

Type Parameters ​

T ​

T extends BaseDataPoint

Parameters ​

__namedParameters ​

UsePlotOptions<T>

Returns ​

object

containerRef ​

containerRef: RefObject<HTMLDivElement | null>

plotRef ​

plotRef: RefObject<Plot | null>