I have reached a similar solution a while back (lots of searching)
- entity: sensor.solar_forecast
show:
in_header: false
legend_value: false
name: today
yaxis_id: value
color: '#ffa600'
opacity: 1
stroke_width: 1
float_precision: 1
unit: kWh
offset: '-1h'
data_generator: >
let res = []; for (const [key, value] of
Object.entries(entity.attributes.forecast.result)) {
res.push([new Date(key).getTime(), value/1000]);
} return res
in my graph (this is a combined card obviously)