Skip to content
EliteChart

ChartRef

Documentation


Documentation / @elitechart/react / ChartRef

Defined in: react/src/types.ts:84

Imperative handle exposed via ref on <Chart />.

handle is null until the engine boots on first paint and after the component unmounts. Use useChart to subscribe to the mount lifecycle reactively rather than reading ref.current.handle directly inside render.

Example

code
const ref = useRef<ChartRef>(null);
useEffect(() => {
  ref.current?.handle?.setKind('line');
}, [activeKind]);
<Chart ref={ref} series={series} />

Properties

handle

code
readonly handle: ChartHandle | null;

Defined in: react/src/types.ts:86

Live engine handle, or null before mount / after unmount.


store

code
readonly store: ChartHandleStore;

Defined in: react/src/types.ts:88

Internal store — used by useChart.