Observation with the graphs when I open that page

When I open the long term data page and select one of the three options, the graphs are blank.
Fair enough at this point.

I am prompted to select the date and time range the Last 7 days is already selected for me.
So that leads to the question:
If that is the default (?) why aren't the graphs populated to that when you open that page by default?

Just asking.

Is this a feature request or a question?

I'm not really sure. I am just seeing a disconnect with how it works.

I open the graph and it is empty. But when I select the time to show the default is last 7 days - and yet it isn't shown.

Maybe it is a bug report?

Sorry. I am still getting the feel of the forum and how to phrase things.

Given there isn't a Bug report section.

I think it is something that should be addressed as it is confusing with what is happening now.

Internally, pihole uses daterangepicker for the data and time selector. Default selection is set to "last 7 days" in pihole. If you ommit this pre-selection, datarangepicker will choose "today" internally.

(Even if this issue is 3 years old, the behavior is still the same, I just tried it)

Because it takes time to compute the statistics. More the less power your device had. Imagine a fairly active network with a dozen clients and Pi-hole being hosted on a Raspberry Pi Zero. Computing even the last 7 days might be something which needs several seconds. And it is something the database computes internally, so it is also not easily interruptible.

We do not trigger a processing when the page is opened to avoid an additional delay until the user can request what they want.

The long-term statistics are meant as a research tool, not something you use several times every day. It is more a scalpel rather than a kitchen knife. IMO it should allow the user to get what they want without being in their way. Hence, we designed it the way it is.

Yes, and again: Fair enough.

If I leave that page active I don't expect it to be dynamic with real time data.

But when I go to the page and it is asking me (or sorry: saying there is no selection for what to display) the default should be done.

To me that is why you would have a default.
Having it set to 7 days but not actually selecting it seems... strange.

As to get that set of data displayed, I have to select 7 days from the drop down anyway.

Please, for now we'll leave it alone. I have only had it (PiHole) for a few days. I'm still getting used to it and what it is telling me.

I am also getting a bit distracted with the looks rather than the mechanics of it.

Please run

pihole checkout web tweak/db_pages_default

go to your dashboard, force-refresh (Ctrl + F5, something similar if on Mac).

Is this more like you'd expect this to work?

To be honest, I am not seeing any difference. But that may be because I am still not too familiar with what it looks like by default.

My question was more to do with the long term data graphs/pages.

When clicking on the select button, there is no longer a default "7 days" selection.

Yes, right there.

It isn't the dashboard though.

Correct. No default (last 7 days) visible.

So you are satisfied now?

The curiosity is happy.

Thanks.

I won't say it is how I expect it to work.

The post was more a question about what was being shown with defaults that weren't displayed on the graph.
Doing what you said removed the default part.

So yes: That answers the question.

Unfortunately, that's not correct, but harder to see. It's default is now now, and already pre-selected.

This is what I get now, pre-selected is 11.09.2020 and time range between 06:00 and 06:45.

Personal opinion: Until there is a way to really have no selection, leave it with the 7 days pre-selection, even when it can confuse users initially. 7 days is a good range - not to less data to analyze and not to much for low RAM devices.

1 Like

I'm happy enough with what it is now showing compared to what it was showing.

There is none. If you really point the prefilled intervals to null, the following happens:
Screenshot at 2020-09-11 11-15-35

The best we can do is to remove any suggestion of an initial range:
Screenshot at 2020-09-11 11-14-47

You see this makes the selection default to the current day 00:00 - 23:00 (even when it is only 11:19 my local time at this point). This is in agreement with the example referenced in the issue ticket mentioned by @yubiuser above:


Unfortunately, there is a bug in daterangepicker: When you simply click on [Apply], nothing happens when you don't specify a default interval. Even though you'd expect all queries of today given what the screenshot above shows you. I traced this down into a bug in the datetimerpcker engine. It is unexpectedly complex and difficult to fix because if drags its issue through almost a dozen different callbacks. We can, nevertheless, achieve the same thing by setting the default range.

So we have three options on the table:

  1. Do nothing (keeps the preselected "Last 7 Days")
  2. Change the default interval to something else (like the default start - end of today as suggested above)
  3. Store what the user picked last time.

Mind that 3 has a drawback: datetimepicker works with absolute time. When we store your selection of "today" now and you visit the page tomorrow, your preselected range would be "yesterday". Converting things into relative time could be tricky (but I'm not ruling this out if people really want this !).

So what do you expect?

My vote.

Yeah, I think I have to agree here. Having flicked between the devel and tweak/db_pages_default branches for the last 10 mins or so, I think it makes more sense to keep the existing behaviour.