Dynamically updating the color thresholds in an ApexCharts card based on current sensor data #637
Unanswered
JAFC-BandO
asked this question in
Q&A
Replies: 1 comment
-
any progress achieved meanwhile ? |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Does anyone know if its possible to dynamically update the color thresholds in an ApexCharts card based on current sensor data in Home Assistant,
If yes please show exsamaples, so I can see how this is done.
I have sensors :
High Price Threshold
1.897 friendly_name: High Price Threshold
Low Price Threshold
1.442 friendly_name: Low Price Threshold
I want my Apex card to change the color threshold based on these senors:
e.g.
type: custom:apexcharts-card
apex_config:
chart:
height: 350px
experimental:
color_threshold: true
graph_span: 24h
header:
title: Elpriser pr. time (kr/kWh)
show: true
span:
start: hour
offset: '-1h'
now:
show: true
label: Nu
yaxis:
apex_config:
tickAmount: 15
series:
type: column
data_generator: |
var today = entity.attributes.raw_today.map((start, index) => {
return [new Date(start["hour"]).getTime(), entity.attributes.raw_today[index]["price"]];
});
if (entity.attributes.tomorrow_valid) {
var tomorrow = entity.attributes.raw_tomorrow.map((start, index) => {
return [new Date(start["hour"]).getTime(), entity.attributes.raw_tomorrow[index]["price"]];
});
var data = today.concat(tomorrow);
} else {
var data = today;
}
return data;
float_precision: 2
**color_threshold:
color: green
color: orange
color: red
color: darkred**
Beta Was this translation helpful? Give feedback.
All reactions