Chartjs-How to update a chart on prop change in vue-chartjs

0đź‘Ť

If you want to create a chart js and integrate with view, you can create your canvas on js outside of vue js flow, and then get the element reference inside vue and then integrate it, the big problem rendering components inside vue is that you need update your charts, it may cause unexpected behavior on canvas. Because tools like Vue are designed to refresh the html and canvas always are a single html tag with a lot of interactivity in js(not much html).

Vue-chart

You can install
vue-chart.js

It supports data updates and also you can access to the chart ref.

Updating charts: https://vue-chartjs.org/guide/#updating-charts

Acesing to ref: https://vue-chartjs.org/guide/#access-to-chart-instance

Leave a comment