I have struggling with configuring the colors in apex chart. I have two temperature series (line charts) which show temprature in two different parts of the house. I also want to indicate on chart when heater/air conditioner is on and using a column of fixed height to show the state (column is 0 height if it is off).
Now I am not able to get the colors to work. Here is what I am looking to do -
1. Both temperature series should show a color gradient between blue and red. Blue being cold, and red being hot. the gradient should change from blue to red between 40 and 80.
2. The column should change the color to red when heater is on, and blue when air conditioner is on. For this i created a sensor whose value changes to 70 if a/c is on and 71 if heater is on. (I want these values to be very close to each other so column shouldn’t look different height)
Is it possible and if yes, how do I do it ? Here is my apex chart yaml
type: grid
square: false
columns: 1
cards:
- type: thermostat
entity: climate.thermostat
features:
- type: climate-hvac-modes
hvac_modes:
- 'off'
- heat
- cool
- heat_cool
show_current_as_primary: true
- type: custom:apexcharts-card
header:
show: true
title: Temprature
show_states: true
colorize_states: true
graph_span: 2d
apex_config:
grid:
show: true
strokeDashArray: 0
borderColor: '#383838'
position: back
xaxis:
lines:
show: true
yaxis:
lines:
show: true
yaxis:
- id: tempaxis
decimals: 0
min: '|-1|'
max: '|+1|'
- id: hvacon
opposite: true
decimals: 0
min: 0
max: 340
show: false
series:
- entity: sensor.thermostat_current_temperature
curve: smooth
name: Living room Temp
fill_raw: last
color: ff7100
yaxis_id: tempaxis
stroke_width: 2
group_by:
func: avg
duration: 1hr
- entity: sensor.masterbedroom_am2301_temperature
curve: smooth
name: Bedroom Temp
fill_raw: last
yaxis_id: tempaxis
color: ffa600
stroke_width: 2
group_by:
func: avg
duration: 1hr
- entity: sensor.hvac_on
curve: smooth
fill_raw: last
yaxis_id: hvacon
name: HVAC on
stroke_width: 1
color: red
type: column
show:
legend_value: false
name_in_header: false
in_header: false
offset_in_name: false
group_by:
func: max
duration: 5min