From 02c8c480b4d2c9c3ca2803a8d14de8f77cb8b6e2 Mon Sep 17 00:00:00 2001 From: DL6ER Date: Wed, 9 Nov 2016 15:12:18 +0100 Subject: [PATCH] Change data resolution from 1h to 10min in the diagram --- js/pihole/index.js | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/js/pihole/index.js b/js/pihole/index.js index b070bd73..aee7e27f 100644 --- a/js/pihole/index.js +++ b/js/pihole/index.js @@ -107,17 +107,17 @@ $(document).ready(function() { // Pull in data via AJAX - updateSummaryData(); +// updateSummaryData(); updateQueriesOverTime(); - updateQueryTypes(); +// updateQueryTypes(); - updateTopClientsChart(); +// updateTopClientsChart(); - updateForwardDestinations(); +// updateForwardDestinations(); - updateTopLists(); +// updateTopLists(); }); // Functions to update data in page @@ -154,13 +154,21 @@ function updateSummaryData(runOnce) { } function updateQueriesOverTime() { - $.getJSON("api.php?overTimeData", function(data) { + $.getJSON("api.php?overTimeData10mins", function(data) { // Add data for each hour that is available for (hour in data.ads_over_time) { // Add x-axis label - timeLineChart.data.labels.push(hour + ":00"); - timeLineChart.data.datasets[0].data.push(data.domains_over_time[hour]); - timeLineChart.data.datasets[1].data.push(data.ads_over_time[hour]); + if(hour%6 == 0) + { + timeLineChart.data.labels.push(hour/6 + ":00"); + } + else + { + timeLineChart.data.labels.push(""); + } + // Have to multiply the data by 6 to have again the correct units (per hour, not per 10min) + timeLineChart.data.datasets[0].data.push(6*data.domains_over_time[hour]); + timeLineChart.data.datasets[1].data.push(6*data.ads_over_time[hour]); } $('#queries-over-time .overlay').remove(); timeLineChart.update();