Hello,
-
What Grafana version and what operating system are you using?
Grafana 9.3.1 on Linux Debian GNU/Linux 10 (buster) using InfluxDB2 data -
What are you trying to achieve?
user a gauge bar chart to present 24h windows of water usage and calculated price -
How are you trying to achieve it?
Flux language - script and overwrites -
What did you expect to happen?
the bar with the highest value in the last 14 days uses the full column width -
Can you copy/paste the configuration(s) that you are having problems with?
see below script and result. If I delete the 3.6563 multiplier for getting the price, all works good.
I tested also by dividing by 10, then also the bars use the full window.
It looks like, that the column width “auto mode” uses the resulting costs value _cost for the width calculation and not the _value one.
Is this a bug or do I have to solve this in a different way?
a) Script
import "timezone"
option location = timezone.location(name: "Europe/Berlin")
from(bucket: "SmartHome")
|> range(start: -14d)
|> filter(fn: (r) => r["_measurement"] == "watermeter.verbrauch" and r["_field"] == "value")
|> difference()
|> aggregateWindow(every: 24h, fn: sum, timeSrc: "_start")
|> map(fn: (r) => ({ r with _cost: r._value * 3.6563}))
B) result
C) Overwrite for this column
Thanks for any idea.