Skip to content

Commit 89a7cac

Browse files
payalordapertureless
authored andcommitted
fix(core): Delete old chart.js instance first (#375)
Before creating new instance we need to run destroy() on old instance if it is exists to avoid **Hovering over line chart shows old chart data** bug problem, which is described here: chartjs/Chart.js#920 jtblin/angular-chart.js#187 ### Fix or Enhancement? Fix - [x] All tests passed ### Environment - OS: Windows 7 - NPM Version: 6.1.0
1 parent 9e9ea44 commit 89a7cac

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/BaseCharts.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export function generateChart (chartId, chartType) {
6363
this.$data._plugins.push(plugin)
6464
},
6565
renderChart (data, options) {
66+
if (this.$data._chart) this.$data._chart.destroy()
6667
this.$data._chart = new Chart(
6768
this.$refs.canvas.getContext('2d'), {
6869
type: chartType,

0 commit comments

Comments
 (0)