From 3e377aa63ddd2ac4f649f857bdca532ac0df046e Mon Sep 17 00:00:00 2001 From: bvn13 Date: Tue, 21 Apr 2020 02:52:14 +0300 Subject: [PATCH] try to fix chart blinking bug --- covid19-site/src/main/resources/templates/main-page.html | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/covid19-site/src/main/resources/templates/main-page.html b/covid19-site/src/main/resources/templates/main-page.html index d7be108..50d73b8 100644 --- a/covid19-site/src/main/resources/templates/main-page.html +++ b/covid19-site/src/main/resources/templates/main-page.html @@ -93,7 +93,11 @@ : 0 ); - var myChart = new Chart(ctx, { + if (window.myChart) { + window.myChart.destroy(); + } + + window.myChart = new Chart(ctx, { type: 'line', data: { labels: labels,