From 0e04ba0fe4280dfb6aaf407102d76fc14a0d8f89 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Tue, 26 Apr 2022 15:02:13 -0300 Subject: [PATCH] Show "other" destination as the last graphic item - Show the item only if it's different than zero Signed-off-by: RD WebDesign --- scripts/pi-hole/js/index.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 9849d7aa..7c9e3721 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -538,8 +538,11 @@ function updateForwardDestinationsPie() { values.push([key, value, THEME_COLORS[i++ % THEME_COLORS.length]]); }); - // Move the "other" element to the end of the array - values.push(values.splice(values.indexOf("other"), 1)[0]); + // Show "Other" destination as the last graphic item and only if it's different than zero + var other = values.splice(values.findIndex(arr => arr.includes("other")), 1)[0]; + if (other[1] != 0) { + values.push(other); + } // Split data into individual arrays for the graphs values.forEach(function (value) {