Display Data in Graph Panel for some Custom Range for time in X-Axis

I know of no way to select dates & times by epoch - this is such an unwieldy
format for most people to use that I’ve never seen it offered in a user
interface.

Also, you cannot have different time ranges for different panels, unless this is
defined in the query for the panel, in which case it is not then selectable
from the date picker. The date picker applies to the entire dashboard, and
any panel which uses “$timeFilter” in its query will have the same date / time
selection.

However, in terms of simply selecting times, here is what I see (using Grafana
6.5.2):

  1. Click on the date/time picker at the top right - when you hover the mouse
    on it, it should show you the current range (with both date and time) which is
    being shown.

  2. Once you’ve clicked on it, select “Custom time range” at the top of the
    menu.

  3. You should see a “From” box with a month calendar underneath it, and to the
    right of that, a “To” box with another month calendar underneath it, and an
    “Apply” button underneath both calendars.

  4. Select “11” in each calendar, for 11th January 2020. You should see
    “2020-01-11 00:00:00” appear in the “From” box, and “2020-01-11 23:59:59” in
    the “To” box.

  5. You can now click onto the times and edit them to whatever you wish, for
    example “17:00:00” and “18:59:59”, and when you click on “Apply”, that’s the
    date and time range which will be used for your graphs.

If the above does not match your experience, let us know which version of
Grafana you’re working with, and at which point in the above steps it doesn’t
work as I’ve described.

Regards,

Antony.

I can convert epoch to normal time using https://www.epochconverter.com/ , so I can get from and to normal GMT times, now can you please tell me how to show different time ranges in each Graph Panel (for normal GMT times). Any clear document?

I don’t know of any documentation for this, but my approach was as follows:

  1. Use the date picker to select a date & time range of interest.

  2. Go to the Query Inspector to see what Grafana has converted “$timeFilter”
    into for that date / time range.

  3. Replace “$timeFilter” in your query (you’ll need to use the raw mode editor
    for this) with the same syntax, substituting whatever date / time range you
    want for the particular panel.

  4. Repeat step 3 for each panel you want to give a bespoke date / time range
    to.

Hope that helps,

Antony.

Graph panel showing entire Date Range whatever range selected from DatePicker, even though I’ve modified query between 2 epoch dates.

If above approach works for you, can you please send me any screenshot fo yours having graph panel showing only between some time range

Here’s a sample of four graph panels and six singlestat panels covering three
different timescales; the “Last 7 days” selection at the top right is
irrelevant / ignored, however the dashboard does update every 15 seconds as
indicated.

Regards,

Antony.

Nice! Is that possible to share me your dashboard or query of your 90 minutes graph panel? I mean can you share me your query and panel settings which is displaying just only for 90 minutes?

Ah, that one I’ve done using the Time Range override facility.

The query is simple:

select RTT from stats where topic=‘Calls’ and Dir=‘outbound’ and $timeFilter

But I’ve specified “90m” for Override Relative Time for the Time Range.

Regards,

Antony.

I have a doubt, your global time filter is: 7 days and you just kepted Relative Time as 90m, then how it picked 11:50 to 13:10? and what GMT time region we need to select? if possible, screenshot of your dashboard query might helpful.

I have a doubt, your global time filter is: 7 days and you just kept
Relative Time as 90m, then how it picked 11:50 to 13:10?

Because I took that screenshot at 13:12, and 90 minutes before that is 11:42.

You can see from the additional “graph space” before and after the first / last
labels on the X-axis that that’s the timescale the graph covers.

and what GMT time region we need to select?

I am not in GMT; I am in CET.

if possible, screenshot of your dashboard query might helpful.

Sorry, can’t manage that. I provision all panels using JSON, and since
Cannot create query - new Grafana installation I can’t view
anything useful in edit mode in the browser.

It still works fine in Grafana 5.4.5, but that looks completely different, so
isn’t helpful for you.

What I can share is the information from the Query Inspector, which tells me
that the query Grafana is submitting to my back-end data store is:

select RTT from stats where topic = ‘Calls’ and Dir=‘outbound’ and time >=
now() - 90m

So, what Grafana has done is to set $timeFilter to “time >= now() - 90m”

That’s the sort of things you can do manually if you want to create more
complex exceptions for individual panels.

Antony.

Okay, Many Thanks Antony for your replies. I also try using now() - 90m and I will update you.

As you’ve inserted data in db just now and then added now() - 90m, so graph showing good, but if you come later again (say after 2 days), then now() - 90m, will show you empty data in graph panel, right?

Well, yes.

I would not want a graph of “the last 90 minutes” to show me data from 2 days
ago.

What (timescale) do you want the graph to show?

Antony.

My only requirement to show data between some time range (say some hrs) in some graph panel. and when I come back after some days in same dashboard, I want to see same graph… So, basically looking for a graph having data between 2 time ranges

I can’t think of any way to achieve that with a different range for different
panels.

You can easily do this for the entire dashboard (as I explained in my second
reply in this conversation, with steps 1-5 outlined), but I know no way to do
it differently for different panels.

Antony.

Hmm okay… But I think this feature should also be there… not sure why no one had this kinda requirement yet! Anyway Thanks again Antony for your time!

I think the answer is that Grafana is designed as a real-time display of data
from a time-series database, and although you can click into graphs and see
different time ranges (such as one day three months ago) when you want to do a
bit of analysis, the general expectation is that the system always tells
what’s going on right now, and for some definable period into the past.

It’s not really intended to show you today’s data and stay like that into
tomorrow, the next day, and so on. I mean, when should it change to show you
“today’s” data the next time (for whatever day you want to define as “today”
sometime next week or whenever)?

Antony.

In case it has not already been mentioned you can specify a time range by setting the range in the URL. So if you have a regular requirement for particular ranges you could set up a set of links on a web page somewhere or in a document that take you to those ranges.

Why can’t implement this same thing for Graph Panel too? (just like gave option to mention some time (epoch) range in URL)

Hey i know its an old thread, is there anyway f doing the reverse. As in for my use case I dont want the flexibility of the timepicker, so I have made template variables, but the x-axis on the graph panels doesnt change when i change the template variable.

1 Like

I am also facing the same problem, I dont see any solution for this

Also some time the bar graph is not showing the value for some time variables, when we apply different time range

1 Like