Skip to content

Commit

Permalink
fix(core): Delete old chart.js instance first (apertureless#375)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
payalord authored and apertureless committed Jun 18, 2018
1 parent 9e9ea44 commit 89a7cac
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions src/BaseCharts.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 89a7cac

Please sign in to comment.