Different group time on graph


Is it possible to automatically group graph by different time when choosing different time range?
I want to make rain amount graph with bars. I would like to group values by 1h in time range to for example 2 days, but when I set time range 7 days I would like to group values by 1d.
Or is there any other method to make this graph?

It may depend on what kind of datasource you’re using. You may be able to use $__interval or $__interval_ms variables.


I would like to do the same with the simple json datasource. Usecase is a json api that allows grouping by desired time range to output consumption data, e.g. of electrical power.

I’ve found I can do this by

a) specifiing separate time ranges per panel and
b) use https://github.com/grafana/simple-json-datasource/pull/104 to submit additional query parameters to the json data source