Skip to content

Function: useChart() ​

ts
function useChart<F, View>(dashboard, spec): UseChart;

Defined in: packages/svelte/src/runes.svelte.ts:116

Add a chart to a dashboard for as long as the calling component lives.

Pass the spec as a getter to make it reactive. The chart is recreated (and its filter cleared) when the dashboard or the spec's id, dimension, value or extra change; a change to view or renderer only redraws it.

Type Parameters ​

Type ParameterDefault type
F extends string-
Viewunknown

Parameters ​

ParameterType
dashboardDashboardSource<F>
specMaybeGetter<ChartSpec<F, View>>

Returns ​

UseChart

Released under the MIT License.