# Grafana shows wrong date on bottom of bar chart

**URL:** <https://community.grafana.com/t/grafana-shows-wrong-date-on-bottom-of-bar-chart/144003>\
**Category:** Grafana\
**Tags:** bar-chart\
**Created:** [February 16, 2025, 5:29pm UTC](https://community.grafana.com/t/grafana-shows-wrong-date-on-bottom-of-bar-chart/144003 "2025-02-16T17:29:25Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![siegelej](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@siegelej](https://community.grafana.com/u/siegelej)\
**Post date:** [February 16, 2025, 5:29pm UTC](https://community.grafana.com/t/grafana-shows-wrong-date-on-bottom-of-bar-chart/144003/1 "2025-02-16T17:29:26Z")

</div>

Hello,

i am struggling to make a correct bar chart. I want to display the producet energy by ma solar system. It works so far but shows the wrong date on bottom of the bars.  
The values are correct.

The last bar is correct. All the others are 1 day ahead (10.02 should be 09.02 and so on). 16.02. is there twice, the first should be 15.02 the second is correct.

 ![grafana](https://us1.discourse-cdn.com/grafana/original/3X/4/e/4ebf81458aeb6e2ad462e85061b8ecef0a77b2ed.png)

Can aynone please help me.

regards johannes

---

<div class="post-metadata">

**Author:** ![ebabeshko](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@ebabeshko](https://community.grafana.com/u/ebabeshko)\
**Post date:** [February 17, 2025, 5:06pm UTC](https://community.grafana.com/t/grafana-shows-wrong-date-on-bottom-of-bar-chart/144003/2 "2025-02-17T17:06:43Z")

</div>

Try changing

```auto
    |> aggregateWindow(every: 1d, fn: max, createEmpty: false)

```

to

```auto
    |> aggregateWindow(every: 1d, fn: max, createEmpty: false, timeSrc: "_start")

```

[Description of timeSrc parameter](https://docs.influxdata.com/flux/v0/stdlib/universe/aggregatewindow/#timesrc)

---

<div class="post-metadata">

**Author:** ![siegelej](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@siegelej](https://community.grafana.com/u/siegelej)\
**Post date:** [February 17, 2025, 7:32pm UTC](https://community.grafana.com/t/grafana-shows-wrong-date-on-bottom-of-bar-chart/144003/3 "2025-02-17T19:32:46Z")

</div>

Thank you for the tip.  
It helped at the end of the date but brought another problem. When i select the “Last 7 days” it does not take the first day full, but starts from now 7 days back and so it does not show the full data for the first day. In the picture it should be 34.8 for the first day (not 32.1).

If i change the time range on top from “now-7d to now” TO “now-7d/d to now” it works, but gets wrong every time I change the range via quick range. Is there also a way to save the additional /d for the time range?

 ![grafana](https://us1.discourse-cdn.com/grafana/original/3X/4/2/42ee786042c856ebdb47ae3575920f0ad5acc3ad.png)

---

<div class="post-metadata">

**Author:** ![ebabeshko](https://avatars.discourse-cdn.com/v4/letter/e/9d8465/32.png) [@ebabeshko](https://community.grafana.com/u/ebabeshko)\
**Post date:** [February 18, 2025, 7:04pm UTC](https://community.grafana.com/t/grafana-shows-wrong-date-on-bottom-of-bar-chart/144003/4 "2025-02-18T19:04:30Z")

</div>

> [@siegelej](#):
>
> Is there also a way to save the additional /d for the time range?

Try something like this:

```auto
import "date"
from (bucket: "HomeAssistantDB")
|> range(start: date.truncate(t: v.timeRangeStart, unit: 1d), stop: v.timeRangeStop)
...

```

---

<div class="post-metadata">

**Author:** ![siegelej](https://avatars.discourse-cdn.com/v4/letter/s/cab0a1/32.png) [@siegelej](https://community.grafana.com/u/siegelej)\
**Post date:** [February 19, 2025, 8:54am UTC](https://community.grafana.com/t/grafana-shows-wrong-date-on-bottom-of-bar-chart/144003/5 "2025-02-19T08:54:07Z")

</div>

Works perfectly for me.  
Thank you very much!
