How does InfluxDB 2.0 UI X-axis Auto Scale/Zoom to Time Range with Data

Hello,

I’m now upgrading the InfluxDB to 2.0.8 version and learning the new UI and Flux language. When I made a query, I found the InfluxDB 2.0 UI doesn’t auto-scale x-axis to real data as what it used to be in the older UI (chronograf).

For example, suppose I have some data in 2018, and I want to quickly query and display the data. When I use chronograf in InfluxDB 1.8, I just execute:

SELECT * FROM test

Then the x-axis auto zoom to where data points exist, regardless of the window start and end time. That makes sense, because you need to first know where is the data, then set the window range after that. The result was as follows:

However, in InfluxDB 2.0 UI, when I make a query, the x-axis doesn’t auto-zoom to real data, but display in a very large time range with no data at all. See the below picture, note the real data is squeezed at the leftmost of the chart. Then I have to drag my mouse several (more than 5) times to zoom into the data.

from(bucket: “mybucket”)
|> range(start: 2000-01-01T00:00:00Z, stop:2020-01-01T00:00:00Z)
|> filter(fn: (r) => r["_measurement"] == “test”)

I tried if I can query without a time range as I did before, but was unlucky:

from(bucket: “mybucket”)
|> filter(fn: (r) => r["_measurement"] == “test”)

So my question is:
(1) How does InfluxDB 2.0 UI auto-zoom to the range of real data points exist?
(2) Related to the first question, if I drag mouse to zoom in the display window, can this UI auto-zoom to where real data points exist? This way I don’t need to drag 5+ times just to zoom to the second level.
(3) Is it possible I can make a query without setting time range as in fluxQL, something like SELECT * FROM test?
(4) Are there any convenient shortcut I could use to achieve the previous auto-zoom as a walk-around?

Any advice is helpful. Thanks a lot!

Hello!

There are a couple of in-progress improvements to the 2.0 UI related to setting the X-axis that will hopefully address your first two questions, see X Axis doesn't respect the start and stop times of the query (always uses now) · Issue #2482 · influxdata/ui · GitHub & Graphs that override the dashboard's time selection should show an indicator · Issue #2157 · influxdata/ui · GitHub.

For (3), it is not possible to do a flux query without a time range. You can do something like range(start: -2y) as applicable if you just want to get all the data though - just specific a start time that is sufficiently far back.

I’m not aware of any shortcuts that would allow you to have the graphs automatically zoom to the time range that only contains data at the moment. I think the best way to accomplish this would be to adjust the custom time range in the UI after you know where your data starts and stops.