hi !
with this flux query, i’ve a nice stacked bar graph but i want to change the x axis to see only the month
import "date"
from(bucket: "homeassistant/15min")
|> range(start: 2024-01-01T00:00:00Z, stop: 2024-12-31T23:59:59Z)
|> filter(fn: (r) => r._measurement == "kWh" and r._field == "mean_value")
|> filter(fn: (r) => r.entity_id == "chambre_christophe_heat_energy_consumption" or r.entity_id == "chambre_christophe_cool_energy_consumption")
|> window(every: 1mo)
|> reduce(fn: (r, accumulator) => ({
heat: if r.entity_id == "chambre_christophe_heat_energy_consumption"
then (if exists accumulator.heat then accumulator.heat + r._value else r._value)
else (if exists accumulator.heat then accumulator.heat else 0.0),
cool: if r.entity_id == "chambre_christophe_cool_energy_consumption"
then (if exists accumulator.cool then accumulator.cool + r._value else r._value)
else (if exists accumulator.cool then accumulator.cool else 0.0)
}), identity: {heat: 0.0, cool: 0.0})
|> map(fn: (r) => ({ r with _time: r._stop }))
|> timeShift(duration: -1mo)
so i add these lines
|> map(fn: (r) => ({ r with
mois:
if (date.month(t: r._time)) == 1 then "Janv"
else if (date.month(t: r._time)) == 2 then "Fev"
else if (date.month(t: r._time)) == 3 then "Mars"
else if (date.month(t: r._time)) == 4 then "Avr"
else if (date.month(t: r._time)) == 5 then "Mai"
else if (date.month(t: r._time)) == 6 then "Juin"
else if (date.month(t: r._time)) == 7 then "Juil"
else if (date.month(t: r._time)) == 8 then "Aout"
else if (date.month(t: r._time)) == 9 then "Sept"
else if (date.month(t: r._time)) == 10 then "Oct"
else if (date.month(t: r._time)) == 11 then "Nov"
else if (date.month(t: r._time)) == 12 then "Dec"
else "error",
}))
|> keep(columns: ["mois", "heat", "cool"])
i lost the stacking, the bars are put together : how to have the stacking again ?
i’ve tried to drop the column _time, but i lost all the graph



