Bars with data for yesterday, shown for today

Hello,

Grafana docker: Grafana v8.0.6 (68fe9e3431)
Host OS: Ubuntu 20.04.2 LTS (GNU/Linux 5.4.0-80-generic x86_64)

I have Influxdb collecting data, and Grafana to display it. Grafana shows bars with the data each day. The data is being aggregated for 1d. However the bars are being created at 00:00:00 hour, which is technically the next day. So in the balloon that Grafana creates when I hover over the bar, shows the next day as date.

I am expecting Grafana not to start creating the bar at 00:00:00, but at 59:59:59, so it will show as the same day. Or create it at 00:00:00, but place it at 59:59:59. Or I need to be able to define when a day starts and ends.

I found several similar topics in the forum, but with no answers.

The bars are representing the differecen beween the value for the last day, and today.

Here are my queries:

This is the difference between yesterday and todays targets bars:
from(bucket: “bucket”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “Targets_Stats” and r._field == “targets_total”)
|> aggregateWindow(every: 1d, fn: last)
|> difference(nonNegative: false, keepFirst: true)

This is the line with total targets:
from(bucket: “bucket”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r._measurement == “Targets_Stats” and r._field == “targets_total”)
|> aggregateWindow(every: 1d, fn: last, createEmpty: false)
|> map(fn: (r) => ({ r with _value: r._value / 1000000.0}))

I am using " |> map(fn: (r) => ({ r with _value: r._value / 1000000.0}))", because, as both Y axes use “short” units, they are not being show ( but I will open new topic about that )

I had "ixed/work around the issue by adding timeSrc: "_start" to aggregate function like this:

|> aggregateWindow(every: 1d, fn: last, timeSrc: “_start”)

Best regards.

This topic was automatically closed after 365 days. New replies are no longer allowed.