From a8b4cb74d8ca4ee3130aa0b98a6ec2e9abcbeae1 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Sat, 15 Jun 2019 17:20:49 +0200 Subject: [PATCH] Check data before converting. This allows us to detect if there is no data for the graph so we can hide it. Fixes #932 Signed-off-by: DL6ER --- scripts/pi-hole/js/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/scripts/pi-hole/js/index.js b/scripts/pi-hole/js/index.js index 17f1e092..21e00bda 100644 --- a/scripts/pi-hole/js/index.js +++ b/scripts/pi-hole/js/index.js @@ -261,15 +261,16 @@ function updateClientsOverTime() { return; } - // convert received objects to arrays - data.over_time = objectToArray(data.over_time); - // Remove graph if there are no results (e.g. privacy mode enabled) if(jQuery.isEmptyObject(data.over_time)) { $("#clients").parent().remove(); return; } + + // convert received objects to arrays + data.over_time = objectToArray(data.over_time); + // remove last data point since it not representative data.over_time[0].splice(-1,1); var timestamps = data.over_time[0];