Relative time setting in Edit panel does not work with now-0d/d to now+1d/d (today&tomorrow)

Using time setting “now-0d/d to now+1d/d” in dashboard absolute time settings grafana show graphs for today and tomorrow and it works great as shown in the picture enclosed. I want to set it in panel relative time override but it does not work the same way there copying “now-0d/d to now+1d/d” from dashboard bar (inside green circle in picture) into the relative time field . Does anyone know how to write the time settings for today&tomorrow that works in edit panel relative time field?

please see the enclosed pictures from dashboard and from the panel edit

Hello @sungtroll,

Since the two graphs are not showing the same curve, I assume you have two queries to retrieve the data for two different fields. Please ensure that you have data in your database for the time = day +1 for the field corresponding to the green graph. Also, even if it’s with a single field, ensure that you have the data you wish to display for day +1!

Regards

It did not help to disable the graph that has no data for tomorrow in the edit panel window.
In grafana dashboard after input the dates from and to in the absolute time range selection window fields “from” and “to” it works as expected and the date range is later displayed at the top status bar as "“now-1d/d to now+1d/d” as shown in the picture with green circle around it. When copying this time range to the edit panel relative time field the graph windows show no data and a warning displays the message “Cannot read properties of undefined (reading ‘valueOf’)”. In the relative time field in edit panel it seems that it is not possible to use the “to” between the dates to select two time ranges at one graph today and tomorrow (from the start of today to the end of tomorrow) so the question is how to use the relative time to get the result of 2 time ranges today from the beginning of the day to the end of tomorrow.

Hey,

It seems to be a query problem you’re experiencing.
Could you show how your data looks? Additionally, since you’re using InfluxDB V1, I recommend using raw mode for your queries as it provides more flexibility.
Can you also provide the query for the yellow graph?
By the way, I executed a query with a time range from value to value, but I’m using a WHERE time BETWEEN clause:

SELECT SUM(total_tx) 
FROM supervision.bandwidth 
WHERE agent_host IN ($routerIP )
  AND time BETWEEN 
    (select MAX(time)
     from supervision.bandwidth) - 43200
    AND
    (select MAX(time)
     from supervision.bandwidth)

Since you know the time you want (i.e., + 1 day), you can start testing with static values and then switch to using dashboard variables, which also works—I’ve done it myself.

Regards

1 Like

Yellow graph. Strømpris (energy price that changes every hour):
SELECT last(“total”) FROM “energy” WHERE $timeFilter GROUP BY time($__interval) fill(previous)

If running query inspector it shows:
SELECT last(“total”) FROM “energy” WHERE time >= 1710716400000ms //(today my comment) and time <= 1710874926352ms //(end of tomorrow my comment) GROUP BY time(2m) fill(previous)
It does not change anything to input this in the query and saving then changing grafana time range to today for all other windows the window with energy prices for today and tomorrow follow the global grafana time range setting.

The time selectection in query is only for getting the data but it wont change the time of the display window. The display window time range only changes from grafana time selection or if being overrided for just this windows and is done in Relative time field in editor not in the data query.

The data contains just hourly epoch timestamps 10 digits and a value containing the price for that hour here data shown collected from query inspector.
Array 0
0:1710716400000 //(first hour timestamp)
1:1710716520000 //(next hour timestamp
2:1710716640000 //(third hour timestamp)
Array 1
0:0.80 //(first hour energy price)
1:0.81 //(second hour energy price)
2:0.79 //(third hour energy price)

and so on…

Day-ahead (Tomorrows) energy prices are set at Norpool energy market at 13;00h every day then collected and stored in my influx database and i want it to be shown in grafana together with todays energy prices for planing ahead for best time and day for charging electical car and things like that.

I want to be able to change the time range for all other windows while this windows stay always showing the time range for today&tomorrow (historic data&future data) in this one window.

I have figured it out by myself. Please see pictures below showing how to do it :slight_smile:


1 Like