From 097a404bf078ebc3db1aadd7f94aa75aa6d2a2fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Mon, 6 Nov 2023 13:03:14 +0100 Subject: [PATCH] Don't show rotation animation for pie chart updates MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Christian König --- scripts/pi-hole/js/index.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 0b1c8e0e..0a9dc5a6 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -118,10 +118,10 @@ function updateQueryTypesPie() { queryTypePieChart.data.datasets[0] = dd; queryTypePieChart.data.labels = k; $("#query-types-pie .overlay").hide(); - queryTypePieChart.update(); + // Passing 'none' will prevent rotation animation for further updates + //https://www.chartjs.org/docs/latest/developers/updates.html#preventing-animations + queryTypePieChart.update('none'); - // Don't use rotation animation for further updates - //queryTypePieChart.options.animation.duration = 0; }) .done(function () { // Reload graph after minute @@ -240,10 +240,12 @@ function updateForwardDestinationsPie() { forwardDestinationPieChart.data.datasets[0] = dd; // and push it at once $("#forward-destinations-pie .overlay").hide(); - forwardDestinationPieChart.update(); - // Don't use rotation animation for further updates - //forwardDestinationPieChart.options.animation.duration = 0; + // Passing 'none' will prevent rotation animation for further updates + //https://www.chartjs.org/docs/latest/developers/updates.html#preventing-animations + queryTypePieChart.update('none'); + forwardDestinationPieChart.update('none'); + }) .done(function () { // Reload graph after one minute