im using Grafana 10.1.2 and FluxQL (influxDB2)
I’m Trying to display the State of Charge from my home battery in a Time-Series Panel using FluxQL
Here is my Query:
|> range(start: v.timeRangeStart, stop: v.timeRangeStop)
|> filter(fn: (r) => r["_measurement"] == "Battery(SoC)")
|> filter(fn: (r) => r["_field"] == "value")
If there is no new value, the last part of the SoC in the Panel is empty. When the SoC changes again, the line connects to the end (because there’s a new value).
When using influxDB instead of FluxQL there’s an option called fill(previous).
Is there something similar to fill(previous) in fluxQL or do you have other solutions?
Have you tried the last function?
last() returns the last row with a non-null value from each input table.
with last() I get (as you said) the last value. For the time-series-panel I need more than one value.
Here is my example 1 (Battery Power):
The Battery was full around 13:00. Now it’s 13:46 and the line doesn’t continue, because there’s now powerflow into or out of the battery and because of that the value hasn’t been updated since 13:00.
Here is my example 2 (State of Charge):
It’s the same with the state of charge. When i reach 100%, there are no more values written into the influxdb. So the line stops at 12:00.
Here is the same example with influxDB1.x, where I can use the fill(previous):
Something similar for FluxQL is the solution I’m looking for
Thanks for explaining further.
I have never used this function, but give it a try:
|> fill(usePrevious: true)
there’s no effect when adding |> fill(usePrevious: true)