Wrong value in graph with bars


#21

Just a thought but the panels in the dashboard that have the wrong time - do they have a “Min time interval” set (under Options in the top right corner)?


#22

No, it is empty. I tried to put 1d and 1h but it didn’t make any difference still 02:00


#23

You’ll have to help me out a bit here. It sounds strange that one panel is correct and other panels are wrong in the same dashboard. Can you provide more details about the queries and the raw data returned. What is the difference between these panels?


#24

with timezone default, swedish time, summer time right now UTC+2 GMT+2

https://snapshot.raintank.io/dashboard/snapshot/Qay53akB086dDMteycMpzenS0EGk78G1

below is query for bottom graph with bars, showing timestamp 02:00

{
  "xhrStatus": "complete",
  "request": {
    "method": "GET",
    "url": "api/datasources/proxy/2/query",
    "params": {
      "db": "domoticz",
      "q": "SELECT difference(last(\"value\")) FROM \"Usage\" WHERE (\"name\" = 'Huset_V') AND time >= now() - 2d GROUP BY time(1d) fill(null)",
      "epoch": "ms"
    },
    "data": null,
    "precision": "ms"
  },
  "response": {
    "results": [
      {
        "statement_id": 0,
        "series": [
          {
            "name": "Usage",
            "columns": [
              "time",
              "difference"
            ],
            "values": [
              [
                1508803200000,
                58400
              ],
              [
                1508889600000,
                44640
              ],
              [
                1508976000000,
                30400
              ]
            ]
          }
        ]
      }
    ]
  }
}

#25

with timezone UTC

https://snapshot.raintank.io/dashboard/snapshot/pvS4QU3sBkZakuEHnj2TAOXUcvkmFDxq

below is query for bottom graph with bars, showing timestamp 00:00 but look at top graph, now top graph is getting time stamp -2 hours from swedish time

{
  "xhrStatus": "complete",
  "request": {
    "method": "GET",
    "url": "api/datasources/proxy/2/query",
    "params": {
      "db": "domoticz",
      "q": "SELECT difference(last(\"value\")) FROM \"Usage\" WHERE (\"name\" = 'Huset_V') AND time >= now() - 2d GROUP BY time(1d) fill(null)",
      "epoch": "ms"
    },
    "data": null,
    "precision": "ms"
  },
  "response": {
    "results": [
      {
        "statement_id": 0,
        "series": [
          {
            "name": "Usage",
            "columns": [
              "time",
              "difference"
            ],
            "values": [
              [
                1508803200000,
                58400
              ],
              [
                1508889600000,
                44640
              ],
              [
                1508976000000,
                30992
              ]
            ]
          }
        ]
      }
    ]
  }
}

#26

Not sure I see the problem? UTC is Swedish time - 2 hours so looks right to me?

Is the problem that you only want to change the timezone for one panel?

P.S. Great examples with the snapshots - much easier to understand than text.


#27

Thanks.

Problem is that I want to use Swedish time for all dashboards and “bar-graph” should be timestamp 00:00, so Yes, only want to change to UTC for bar-graph(bottom graph).
I think this must be a bug when using bars and group-by time=1d or 24h.


#28

I don’t understand why this is a bug. Looks to me like it works as intended.

There are timeshifting options if you want to change the time for one dashboard: http://docs.grafana.org/reference/timerange/#panel-time-overrides-timeshift


#29

for me a 24h time stamp should start at 00:00 and not 01:00.
I tried with those settings and it doesn’t change the time stamp.


#30

I’m struggling with the same issue.

Here’s an image to help explain it.
My line graphs are perfect. They are displaying the correct dates and times as they should be.

The problem is with the 24-hour bar graphs. They are offset by the amount of my timezone, which is +10 hours. As per what @flopp said, I would like these to start at 00:00 for the day. This would make it much easier to read. As it is, unless I hover over the top, it’s not apparent which bar is for which day.

I have my Dashboard timezone set to Local Browser, which, as mentioned earlier is correctly displaying for the line graphs.
The issue with the 24-hour bar graph looks like a bug.


#31

Upon closer inspection, I wonder if it is the widths/spacings of the bars which is the problem?

Here are a few examples of different group intervals.

1 minute

2 hours

3 hours

And 6 hours

In the first two images (time intervals) they are spaced so that the beginning of the next day is right on 00:00.
But after that in the next two images, the spacings get weird and don’t display the correct intent.


#32

If you hover over the first bar, what timestamp does the tooltip show?


#33

Hi All,

I am having the same problem with a query grouping by 1 day.

I have attached a screenshot below which shows at the top the value I am trying to display (I am trying to select the maximum value that occurs on any one day).

The second row shows a query on the same data where the maximum grouped by 1d is selected.

What I was expecting is that the 1d grouping would start at 00:00, however as you can see by the tooltop it starts at 11:00.

I dont think its a coincidence that my timezone is GMT+11.

What this leads me to believe is that the grouping of 1d (or 24h) incorrectly starts (groups) from GMT 00:00 rather than the local timezone 00:00.

This all looks to be consistent with what @chadsmith has observed.

Is there a way to force the query when to start the grouping?


#34

I think I have solved this by reading the influxdb documentation.

You can set an offset in the query to specify where the boundaries of the grouping occur.

Refer to: http://docs.influxdata.com/influxdb/v1.0/query_language/data_exploration/#advanced-group-by-time-syntax

I hope this helps someone else out!

52 AM


#35

@nicp That’s what I eventually figured out, and what I came here to say in reply to your previous post.
But this is only a workaround for what looks to be a bigger issue.

You’ve shown additional evidence of exactly what I found, which is that a line graph is fine, but a bar graph has issues.


#36

Problem is in Influx, timezone is not used when using Group by. Can this be something with my error?
When I look at the query in Grafana, there is no tz included so maybe Grafan is using another method to handle this?
please read last post in this topic


#37

I think tz() is the solution
See these pictures

without tz()

with tz()

I did check Domoticz(that send these data to Influx) and it is correct kWh when using tz()
If not using tz() I get wrong timestamp and also kWh is wrong