From 876224845424850d4821203a0f8944ade4cf343b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christian=20K=C3=B6nig?= Date: Thu, 13 Oct 2022 18:33:30 +0200 Subject: [PATCH] Go for 0.1 precision 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 | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 9c4fe11f..474fb9f9 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -724,15 +724,15 @@ function updateSummaryData(runOnce) { } function doughnutTooltip(tooltipLabel) { - var percentageTotalShown = tooltipLabel.chart._metasets[0].total.toFixed(2); + var percentageTotalShown = tooltipLabel.chart._metasets[0].total.toFixed(1); // tooltipLabel.chart._metasets[0].total returns the total percentage of the shown slices - // to compensate rounding errors we round to two decimals + // to compensate rounding errors we round to two one decimal var label = " " + tooltipLabel.label; - // even if no doughnut slice is hidden, sometimes percentageTotalShown is only 99.99 - // we therefore use this value to decide if slices are hidden - if (percentageTotalShown >= 99.99) { + // even if no doughnut slice is hidden, sometimes percentageTotalShown is slightly less then 100 + // we therefore use 99.9 to decide if slices are hidden (we only show with 0.1 precision) + if (percentageTotalShown > 99.9) { // All items shown return label + ": " + tooltipLabel.parsed.toFixed(1) + "%"; } else {