Flux & usePrevious

Hi, i have on/off data which is saved into the database on change. I want to plot a rectangular graph. This works fine besides that at the last data point the graph stops plotting. I Just want to continou the last on/off state, because it is still valid. I though the could be achieved with fill :confused: What i’m doing wrong?

from(bucket: "test")
  |> range(start: v.timeRangeStart, stop: v.timeRangeStop)
  |> filter(fn: (r) => r._measurement == "lights" and r._field == "IsOn")
  |> aggregateWindow(every: v.windowPeriod, fn: last, createEmpty: true)
  |> fill(usePrevious: true)

In the following image the graph should be extended in the on state, but it isn’t