diff --git a/web/frontend/src/components/StatsPie.vue b/web/frontend/src/components/StatsPie.vue index 1eb796c..c3e7e7e 100644 --- a/web/frontend/src/components/StatsPie.vue +++ b/web/frontend/src/components/StatsPie.vue @@ -69,6 +69,8 @@ export default class StatsPie extends Vue { stats: StatResult[]; + chart?: Chart; + constructor() { super(); this.stats = []; @@ -152,7 +154,10 @@ export default class StatsPie extends Vue { const headers = sortedStats.map((s) => s.name); const colors = sortedStats.map(() => randomColor()); - const chart = new Chart(ctx, { + if (this.chart) { + this.chart.destroy(); + } + this.chart = new Chart(ctx, { type: 'doughnut', data: { labels: headers,