Skip to content

Commit 39ff839

Browse files
committed
fix(mixins): Check for chartjs instance before rendering chart
Closes #288
1 parent 0506b4e commit 39ff839

File tree

3 files changed

+552
-484
lines changed

3 files changed

+552
-484
lines changed

src/mixins/reactiveData.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ module.exports = {
6363
this.renderChart(this.chartData, this.options)
6464
}
6565
} else {
66+
if (this.$data._chart) {
67+
this.$data._chart.destroy()
68+
}
6669
this.renderChart(this.chartData, this.options)
6770
}
6871
}

src/mixins/reactiveProp.js

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,9 @@ module.exports = {
6363
this.renderChart(this.chartData, this.options)
6464
}
6565
} else {
66+
if (this.$data._chart) {
67+
this.$data._chart.destroy()
68+
}
6669
this.renderChart(this.chartData, this.options)
6770
}
6871
}

0 commit comments

Comments
 (0)