How to auto adjust a chart "resolution" as you change the time range (stock market style)

Hello everyone.

English is not my first language so I hope I can explain it clearly :slight_smile:

I’ve been able to log data into InfluxDB from some sensors using the MQTT telegraf plugin, and using Grafana for visualization.

All is working as expected and I am really happy with the results. However, I am just wondering if is it possible to autosadjust the chart “resolution” panels according to the the time range used in the Grafana UI view, like in the stock markets app:

I will try to explain it better with the following, stock market example:
In the images as much time you go back in time less data is loaded and only the most important logs are shown.





Is it possible to do this in Grafana?

I found a work around adjusting the “GROUP BY - time()”, like seen below.


But I don’t know how to link the time() to the time range
4

For anyone interested I am running Grafana v7.4 on Linux.

Many thanks in advance!

/Andrés

Hi @amalokch,

Grafana provides global variables that will help you achieve just this. I’m not great at influx queries but I think using the $__interval variable in your GROUP BY might help you out. Check out our docs for making an influx query like that:

Many thanks Matt,
I didn’t know about this global variables, they seem so powerful in some applications.

For anyone wondering, to make this thing work you may also need to adjust the “Max data points” under the Query options.

Best regards!

1 Like