Chartjs-Svelte-ChartJS chart binding

1👍

Use bind:property (tutorial) to get the chart reference » REPL

<script>
    ...

    let chartRef

    const onZoomPluse = () => {
        chartRef.zoom(1.1);
    };
</script>

<Line bind:chart={chartRef} options={options} data={data} />

<button on:click={onZoomPluse}>zoom +10%</button>

Leave a comment