mirror of
https://github.com/pi-hole/web.git
synced 2026-05-08 09:39:05 +01:00
Go for 0.1 precision
Signed-off-by: Christian König <ckoenig@posteo.de>
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user