Hello,

I have a graph for GAS CONSUMPTION based on ViCare HA integration.

As the data is sampled from Vitodens boiler every minute then of course the consumption grows steadily on the graph until the end of the day and then drops to zero and starts to grow again.(as seen on the blue lines).

How to change it into bars similar to those marked green showing the real end-of-day consumption for each day?

Thanks.

This is my current InfluxDB Flux script:

from(bucket: “Baza”)

|> range(start: v.timeRangeStart, stop: v.timeRangeStop)

|> filter(fn: (r) => r[“_measurement”] == “m³”)

|> filter(fn: (r) => r[“_field”] == “value”)

|> filter(fn: (r) => r[“domain”] == “sensor”)

|> filter(fn: (r) => r[“entity_id”] == “vicare_heating_gas_consumption_today”)

|> filter(fn: (r) => r[“source”] == “HA”)

|> aggregateWindow(every: v.windowPeriod, fn: mean, createEmpty: false)

|> yield(name: “mean”)

The same entity (“vicare_heating_gas_consumption_today”) is used in HA Energy dashboard and it produces correct chart.

Hello @Robinson,

There isnt a bar graph viz type in InfluxDB v2.

Would you be comfortable with one point to symbolize the max value for every day?

If so you could do something like:

```
from(bucket: “Baza”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
//make sure to start at the start of a day
|> filter(fn: (r) => r[“_measurement”] == “m³”)
|> filter(fn: (r) => r[“_field”] == “value”)
|> filter(fn: (r) => r[“domain”] == “sensor”)
|> filter(fn: (r) => r[“entity_id”] == “vicare_heating_gas_consumption_today”)
|> filter(fn: (r) => r[“source”] == “HA”)
|> window(every: 1d)
|> max()
```

Let me know if this is an acceptable substitute.

Of course, one max value for each day is perfect.

But I must be doing something wrong.

I pasted your code where the Query panel is:

```
from(bucket: “Baza”)
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r[“_measurement”] == “m³”)
|> filter(fn: (r) => r[“_field”] == “value”)
|> filter(fn: (r) => r[“domain”] == “sensor”)
|> filter(fn: (r) => r[“entity_id”] == “vicare_heating_gas_consumption_today”)
|> filter(fn: (r) => r[“source”] == “HA”)
|> window(every: 1d)
|> max()
```

I clicked “submit” and I see something like this where the graph should be:

```
compilation failed: error @1:6-1:21: invalid expression @1:21-1:24: ” error @1:17-1:21: invalid expression @1:14-1:17: “ error @3:11-3:51: invalid expression @3:51-3:53: ³ error @3:11-3:51: invalid expression @3:53-3:56: ” error @3:22-3:43: invalid expression @3:39-3:42: ” error @3:27-3:39: invalid expression @3:24-3:27: “ error @3:47-3:50: invalid expression: invalid token for primary expression: ILLEGAL error @3:50-3:51: invalid expression @3:47-3:50: “ error @4:11-4:49: invalid expression @4:49-4:52: ” error @4:22-4:37: invalid expression @4:33-4:36: ” error @4:27-4:33: invalid expression @4:24-4:27: “ error @4:41-4:44: invalid expression: invalid token for primary expression: ILLEGAL error @4:44-4:49: invalid expression @4:41-4:44: “ error @5:11-5:50: invalid expression @5:50-5:53: ” error @5:22-5:37: invalid expression @5:33-5:36: ” error @5:27-5:33: invalid expression @5:24-5:27: “ error @5:41-5:44: invalid expression: invalid token for primary expression: ILLEGAL error @5:44-5:50: invalid expression @5:41-5:44: “ error @6:11-6:83: invalid expression @6:83-6:86: ” error @6:22-6:40: invalid expression @6:36-6:39: ” error @6:27-6:36: invalid expression @6:24-6:27: “ error @6:44-6:47: invalid expression: invalid token for primary expression: ILLEGAL error @6:47-6:83: invalid expression @6:44-6:47: “ error @7:11-7:46: invalid expression @7:46-7:49: ” error @7:22-7:37: invalid expression @7:33-7:36: ” error @7:27-7:33: invalid expression @7:24-7:27: “ error @7:41-7:44: invalid expression: invalid token for primary expression: ILLEGAL error @7:44-7:46: invalid expression @7:41-7:44: “
```