You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I am making up this card which shall select the right attribute content for the data generator to return the data for the graph
type: custom:apexcharts-card
experimental:
color_threshold: true
graph_span: 1d
hours_12: false
yaxis:
header:
title: Energy price tomorrow (dkk/kWh)
show: true
span:
start: day
offset: +1d
series:
color_threshold:
color: blue
color: cyan
color: orange
color: red
type: column
float_precision: 2
data_generator: |
if (entity.attributes.raw_tomorrow === "-") {
return entity.attributes.forecast.map((hour, index) => {
return [new Date(hour["hour"]).getTime(),
entity.attributes.forecast[index]["price"]];
}else {
return entity.attributes.raw_tomorrow.map((hour, index) => {
return [new Date(hour["hour"]).getTime(),
entity.attributes.raw_tomorrow[index]["price"]];
}
});
each data generator element works in isolation, but wrapped within a conditional statement makes it fail.
I am at odds as to what goes wrong here?
Beta Was this translation helpful? Give feedback.
All reactions