Chartjs-Vue-chartjs v4.0.7 instance access (to chart object)

1๐Ÿ‘

My teammate found the way to access chart instance with these lines, on vue-chartjs 4.0.7 :

const charts = document.getElementsByTagName("canvas");
        const ctx = charts.getContext("2d");

Thank you for your interest.

0๐Ÿ‘

For vue-chartjs v5
https://vue-chartjs.org/guide/#access-to-chart-instance

For v4

    <line-chart
        ref="wrapper"
        :chartOptions="chartOptions"
    />

this.$refs.wrapper.$data._chart

Leave a comment