From d658965abc326e42fadaf3dcb380bbbb7f0b8729 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Fri, 23 Sep 2022 22:21:57 -0300 Subject: [PATCH 1/2] Don't fill the all slots with zeros Signed-off-by: RD WebDesign --- api_db.php | 13 ------------- 1 file changed, 13 deletions(-) diff --git a/api_db.php b/api_db.php index 1f4f6bd3..ec8eaec9 100644 --- a/api_db.php +++ b/api_db.php @@ -339,19 +339,6 @@ if (isset($_GET['getGraphData']) && $auth) { } } - // It is unpredictable what the first timestamp returned by the database - // will be. This depends on live data. Hence, we re-align the FROM - // timestamp to avoid unaligned holes appearing as additional - // (incorrect) data points - $aligned_from = $from + (($first_db_timestamp - $from) % $interval); - - // Fill gaps in returned data - for ($i = $aligned_from; $i < $until; $i += $interval) { - if (!array_key_exists($i, $data)) { - $data[$i] = 0; - } - } - return $data; } From 425139501bdca0c25814da530ad695b45e5dab05 Mon Sep 17 00:00:00 2001 From: RD WebDesign Date: Fri, 23 Sep 2022 22:24:54 -0300 Subject: [PATCH 2/2] Set min and max values for graph xAxis Signed-off-by: RD WebDesign --- scripts/pi-hole/js/db_graph.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/pi-hole/js/db_graph.js b/scripts/pi-hole/js/db_graph.js index bf73f251..82d9bee4 100644 --- a/scripts/pi-hole/js/db_graph.js +++ b/scripts/pi-hole/js/db_graph.js @@ -196,6 +196,8 @@ function updateQueriesOverTime() { } } + timeLineChart.options.scales.xAxes[0].ticks.min = from * 1000; + timeLineChart.options.scales.xAxes[0].ticks.max = until * 1000; timeLineChart.options.scales.xAxes[0].display = true; $("#queries-over-time .overlay").hide(); timeoutWarning.hide();