Summarize() with non-hardcoded range

Is it possible to use summarize() to get the average of the length of the currently rendered graph rather than a hardcoded time range?

for example, I have something like summarize(1h, avg) and I’m rendering “Last 1 hour” so it looks great. But if I change my time range to “Last 6 hours” I want my summarize to automatically change to summarize(6h, avg)

Thanks!

You can do this using maxDataPoints option instead of summarize. max data points is found here:

Set max data points to 1. then add function consolidateBy(sum) to your query,. This should return only 1 data point per whole time range.