Setting different panels to different time ranges in a single dashboard

Hello,

I have 3 panels. I want two of them to look at the last 15 minutes and the third one to look at the last 7 days.

I’ve tried setting the time range individually in each panel, saving, and then saving the dashboard.
But when I reload the page, every panel picks up the dashboard’s default time range and I wasn’t able to find that option and disable it.

How can I make this work?

Thanks,

Hello,

I have 3 panels. I want two of them to look at the last 15 minutes and the
third one to look at the last 7 days.

I have the same type of setup; in my case I have four panels showing the past
hour, the past 24 hours, the past 7 days and the past 28 days.

I’ve tried setting the time range individually in each panel, saving, and
then saving the dashboard. But when I reload the page, every panel picks
up the dashboard’s default time range and I wasn’t able to find that
option and disable it.

How can I make this work?

Here’s how I do it (my data source is Influxdb, but I don’t think that makes
any difference to the query) - I define my panels using JSON, but if you do it a
different way, you should still be able to see the idea from this:

Panel 1:

“hidetimeoverride”: true,
“query”: “select from where and
$timeFilter”,
“timefrom”: “1h”

Panel 2:

“hidetimeoverride”: true,
“query”: “select from

where and
$timeFilter”,
“timefrom”: “24h”

Panel 3:

“hidetimeoverride”: true,
“query”: “select from

where and
$timeFilter”,
“timefrom”: “7d”

Panel 4:

“hidetimeoverride”: true,
“query”: “select from

where and
$timeFilter”,
“timefrom”: “28d”

Feel free to ask further if that doesn’t point you sufficiently in the right
direction.

Antony.

Hey, I think it worked! Thanks!

Hi
having the same question, but do not understand where you edit the JSON for set timefrom etc.
Thnanks

Is there an equivalent way of doing this from the UI?
Maybe through the override section?
I could not find any information on this.

1 Like

You can edit the JSON of each panel by clicking on a panel title, going down
to “More…” and then clicking on “Panel JSON”.

Alternatively you can edit all the panels in a dashboard by clicking on the
gearwheel for “Dashboard settings” and then “JSON Model”.

Antony.

1 Like

Is there a schema for that json somewhere? Because I am not quite sure where to place the timefrom and hidetimeoverride. This is what my json looks like:

{
  "datasource": "grafanacloud-foo-prom",
  "fieldConfig": {
    "defaults": {
      "thresholds": {
        "mode": "absolute",
        "steps": [
          {
            "color": "green",
            "value": null
          }
        ]
      },
      "mappings": [],
      "color": {
        "mode": "thresholds"
      },
      "min": 0,
      "unit": "decbytes"
    },
    "overrides": []
  },
  "gridPos": {
    "h": 4,
    "w": 5,
    "x": 5,
    "y": 6
  },
  "id": 13,
  "options": {
    "reduceOptions": {
      "values": false,
      "calcs": [
        "lastNotNull"
      ],
      "fields": ""
    },
    "orientation": "auto",
    "text": {},
    "textMode": "auto",
    "colorMode": "value",
    "graphMode": "area",
    "justifyMode": "auto"
  },
  "pluginVersion": "7.5.6",
  "targets": [
    {
      "exemplar": true,
      "expr": "mongobackup_dump_size",
      "interval": "",
      "legendFormat": "",
      "queryType": "randomWalk",
      "refId": "A"
    }
  ],
  "title": "Backup Size",
  "type": "stat"
}

Is there a schema for that json somewhere? Because I am not quite sure
where to place the timefrom and hidetimeoverride.

They’re both top-level JSON values, and the order doesn’t matter (Grafana will
put them alphabetically if you do an export).

So, do something like:

“title”: “Backup Size”,
“hideTimeOverride”: true,
“timeFrom”: “7d”,
“type”: “stat”

Antony.

FWIW, I feel like this is also possible from the time range override in the panel query options in the UI (Queries | Grafana Labs). Though maybe that doesn’t provide the level of flexibility desired here…

Hi

I have this exact same issue, I want to track the light level for my plants over the past 3 hours but the temperature and humidity over the past 7 days.

No matter what I try, I can not get these JSON properties to work. Every time I paste them into JSON Model and press Save, Grafana just overwrites “timeFrom” to null and removes “hideTimeOverride” completely.

edit: here is my model: https://pastebin.com/QeREyqjj
edit2: by the way, there used to be a way only three years ago as seen in this post: Multiple Time range? - #8 by torkel but it looks very different now and the “Time Range” tab is nowhere to be found. :frowning:

@longoon12000 did you take a look at the link in my post? I’m not sure why people are resorting to manual JSON edits for this. The option to override the time range for a particular panel is (still…years later) right there under “Query options”, next to the datasource selector in the panel edit screen. Just select whatever custom time range you need for that individual panel (e.g. “7d”) and you should be sorted.

@svetb I have looked into these options and it seems that “Relative Time” is indeed what I need. I had trouble finding this field because it didn’t have this (i) popover that explained what it does and also does not have “range” in its name.
To be honest I didn’t even understand what Relative Time could possibly mean so it was prone to be ignored as an option by me. It was only in the documentation where this was explained and I understood it.
Thanks!

@longoon12000 I think your point about how (non-)intuitive it is to find (or understand) that option is certainly spot on! I do feel like it was called something more obvious previously, and it also potentially had an info pop-up that’s no longer there. Probably a valuable enhancement request to get this sorted. Based on the above thread, you’re clearly not the only one who’s had trouble finding it in the UI…

Hi,

I tried to modify the json - but that does not work for me. I do not find the parameter “hidetimeoverride” and when I try to add the parameter, there comes an error message.

I only found this:

“timeFrom”: “”,
“title”: “$filter_description”,
“type”: “timeseries”,
“timeShift”: null,
“datasource”: null

So how can the JSON be modified exactly for changing the time range. Is it possible to use variables as input parameters in the JSON or defined dates for “timefrom” (like “2021-03-11 12:09:41.340” → correct format?)?

Thank you!
Greetings
Patrick