Using "TimeTo" in JSON to set panel time range does not work

Hi,

I try to set an individual panel time range via JSON.

I found the option “TimeFrom”, where I can set the different time range parameters (for example: 20h, now-10h …). That works well!

But If I set the option “TimeTo” to define the end time of my panel, everything I fill in does NOT work. So what could I do? Or is there an other option to define the end date of the panel (instead of “TimeTo”).

Here my example:

“timeFrom”: “now-20h”,
“timeTo”: “now-10h”,
“title”: “$filter_description”,
“type”: “timeseries”,
“timeShift”: null,
“datasource”: null

And is there a way to set instead of the relative parameter “now-20h” an absolute parameter, for example “2021-03-11 12:09:41.340”? I tried the absolute date in option “TimeFrom”, but that does not work. On the other hand, If I set the absolute date in dashboard options “FROM” and “TO” (manuel time range filter) that DOES work.

Thanks for help.
Greetings
Patrick

Can anyone help?

Thanks!
Patrick

If you want a range starting at now-20h and ending at now-10h you can set the following in the UI:


I haven’t checked what this corresponds to in the dashboard JSON, but perhaps you can share.

Also, I don’t think that absolute timestamps can he used for this. If you do want absolute timestamps then I suppose you can just hardcode those in your query?

Hi thanks for help!

I have already tried it. If I do it this way, I am not able to zoom into a specific timerange, if I need to. Because there will be always a Time shift to the range I selected.

How can I hardcode the absolute timestamps in my query?

Now my query looks like:

SELECT Timestamp as time, Value as value, ChannelId as metric
FROM DataloggerMeasuredValue
WHERE Unit LIKE N’%V%’ AND MeasurementIdentifier in (’${filter_measurementIdentifier}’)

Thanks!
Patrick

Sorry I think I misled you with my comment about hardcoding in the query. That would only change what data is queried, not the actual time range that’s shown in the panel. So unfortunately I don’t have an idea of how to set the time period of a panel to a fixed absolute range.

Right…well I guess the idea of applying an override is that the time period you select overrides (with a specific offset) the dashboard time range that you select otherwise. I’m not sure if a different behavior is supported - though I’d also be up-front about the fact that I haven’t really delved into this (e.g. I’m not sure whether further options are possible through editing the JSON).

Thanks for information!