Function: useChart()
ts
function useChart<F, View>(dashboard, spec): UseChartResult;Defined in: packages/react/src/use-chart.ts:32
Add a chart to a dashboard for the lifetime of a component and follow its data and filter.
The chart is recreated (and its filter cleared) only when the spec's id, dimension, value or extra change as JSON. A change to view only redraws the renderer's view, and a change to renderer (by identity) mounts it again. Creation waits one microtask, so a StrictMode mount, unmount and mount adds the chart once.
Type Parameters
| Type Parameter | Default type |
|---|---|
F extends string | - |
View | unknown |
Parameters
| Parameter | Type |
|---|---|
dashboard | Dashboard<F> | null |
spec | ChartSpec<F, View> |