Fixed #1463 - When Chart component is updated, it throws an exception

pull/1478/head
mertsincan 2021-08-23 16:54:04 +03:00
parent 32d23d01e9
commit 628325522c
1 changed files with 6 additions and 4 deletions

View File

@ -45,6 +45,11 @@ export default {
methods: {
initChart() {
import('chart.js/auto').then((module) => {
if (this.chart) {
this.chart.destroy();
this.chart = null;
}
if (module && module.default) {
this.chart = new module.default(this.$refs.canvas, {
type: this.type,
@ -66,10 +71,7 @@ export default {
}
},
reinit() {
if (this.chart) {
this.chart.destroy();
this.initChart();
}
this.initChart();
},
onCanvasClick(event) {
if (this.chart) {