Skip to content

Documentation / @ripl/vue-charts / useRiplChart

Function: useRiplChart() ​

useRiplChart(): ShallowRef<RiplAnyChart | undefined>

Defined in: vue-charts/src/compositions/index.ts:36

Returns the chart provided by the nearest chart component.

The chart is created during that component's setup(), so this already resolves in a descendant's own setup(). It is undefined outside a chart component, and during server rendering.

Returns ​

ShallowRef<RiplAnyChart | undefined>

The chart, or undefined when there is none.

Example ​

ts
const chart = useRiplChart();

function download() {
    return chart.value?.export().toURL();
}