New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Change over-time graphs from line to stacked bar representation #1098
Conversation
@@ -382,13 +382,6 @@ function parseDBData($results, $interval, $from, $until) { | |||
// $data[timestamp] = value_in_this_interval | |||
$data[$row[0]] = intval($row[1]); | |||
} | |||
|
|||
// Fill the missing intervals with zero |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
With bar graphs, we do not need to fill gaps (there will simply be gaps for empty days). This change enhances processing speed notably.
$.getJSON("api_db.php?getGraphData&from="+from+"&until="+until, function(data) { | ||
|
||
// Compute interval to obtain about 200 values | ||
var num = 200; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This variable controls how many lines will be computed. I don't think we need to make it user-defined, however, I put it in a common place so users can still modify it when they deem it appropriate. We could also make it a global variable, users could then modify this value (live) through the developer tools.
… is much more natural for this kind of data. Also, improve DB graphs to always generate a meaningful display (always generate about 200 bars). This graph was basically unusable when specifying a larger range than, say, one week. Signed-off-by: DL6ER <dl6er@dl6er.de>
They might be functional but they don't follow the best practices, hence why I suggested the above...
(the lines don't match this patch due to the style changes, but it is the date prototype addition and one unused var) Anyway, as long as the above are sorted, this is fine by me. Generally extending the native objects is bad practice. Many things work but it doesn't mean they are OK to do :) |
Signed-off-by: DL6ER <dl6er@dl6er.de>
Signed-off-by: DL6ER <dl6er@dl6er.de>
@XhmikosR I have never learned any language by attending a course so I may not know what best practices are or may have learned them from the wrong people (you never know). Which checker did you use to get the reply you're seeing? I'd like to see the same being mentioned by the CI to teach me how to get better. But this might be what you are looking into with #1080 I addressed the mentioned points meanwhile. |
Once this is merged, we should update the screenshots shown at https://github.com/pi-hole/AdminLTE/blob/master/README.md (see also here: https://github.com/pi-hole/graphics/tree/master/Screenshots) |
This pull request has been mentioned on Pi-hole Userspace. There might be relevant details there: https://discourse.pi-hole.net/t/query-activity-graphs-changed-to-individual-bars/31297/2 |
By submitting this pull request, I confirm the following:
git rebase
)What does this PR aim to accomplish?:
Change over-time graphs from line to stacked bar representation. This is much more natural for this kind of data (it is discrete, not continuous!).
Before
Now
Also, improve DB graphs to always generate a meaningful display (always generate about 200 bars). This graph was basically unusable when specifying a larger range than, say, one week.
Before (this week)
Now (this week)
Before (this month)
Now (this month)
The slight difference seen in the strongest peeks is due to the monotone interpolation of the lines graphs (and wrong!).
How does this PR accomplish the above?:
Change over-time graphs from line to stacked bar representation. Compute interval based on specified time window.
What documentation changes (if any) are needed to support this PR?: