From 89a7cac23ea29c51963517fd4d61719e4c61bb6c Mon Sep 17 00:00:00 2001 From: Azat Ahmedov Date: Mon, 18 Jun 2018 19:56:20 +1000 Subject: [PATCH] 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: https://github.com/chartjs/Chart.js/issues/920 https://github.com/jtblin/angular-chart.js/issues/187 ### Fix or Enhancement? Fix - [x] All tests passed ### Environment - OS: Windows 7 - NPM Version: 6.1.0 --- src/BaseCharts.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/BaseCharts.js b/src/BaseCharts.js index ea79e916..871dc941 100644 --- a/src/BaseCharts.js +++ b/src/BaseCharts.js @@ -63,6 +63,7 @@ export function generateChart (chartId, chartType) { this.$data._plugins.push(plugin) }, renderChart (data, options) { + if (this.$data._chart) this.$data._chart.destroy() this.$data._chart = new Chart( this.$refs.canvas.getContext('2d'), { type: chartType,