Hi all,
I have this chart that displays the breakdown of electricity prices. I’m trying to set a dynamic value for the y-axis maximum. When I use max: auto
, the maximum is set to 5, and the chart isn’t fully visible.
On the other hand, if I remove max: auto
, the maximum is set to approximately twice the highest value in the chart.
I would like to set the maximum to, for example, 110% of the highest value (the total price). I thought about creating a sensor for this, but I don’t know how to set the y-axis maximum to the value of that sensor.
Thanks
type: custom:apexcharts-card
header:
title: Cena elektřiny
show: true
show_states: true
colorize_states: true
apex_config:
chart:
width: 100%
height: 235px
stacked: true
offsetX: 0
yaxis:
tickAmount: 5
max: auto
grid:
padding:
top: -20
bottom: -15
legend:
show: false
graph_span: 1d
span:
start: day
now:
show: true
label: Nyní
series:
- entity: sensor.current_spot_electricity_price
name: Spot cena
float_precision: 2
type: column
color: mediumseagreen
show:
in_header: raw
data_generator: |
return Object.entries(entity.attributes).map(([date, value], index) => {
return [new Date(date).getTime(), value];
});
- entity: input_number.distribuce
name: Distribuce
float_precision: 2
show:
in_header: false
type: column
color: pink
group_by:
func: avg
duration: 1h
- entity: input_number.poze
name: POZE
float_precision: 2
show:
in_header: false
type: column
color: skyblue
group_by:
func: avg
duration: 1h
- entity: input_number.systemove_sluzby
name: Systémové služby
float_precision: 2
show:
in_header: false
type: column
color: dodgerblue
group_by:
func: avg
duration: 1h
- entity: input_number.marze_obchodnika
name: Marže
float_precision: 2
show:
in_header: false
type: column
color: khaki
group_by:
func: avg
duration: 1h
- entity: sensor.dph
name: DPH
float_precision: 2
show:
in_header: false
type: column
color: lightgrey
group_by:
func: avg
duration: 1h
- entity: sensor.celkova_cena_elktriny_s_dph
name: Celková cena s DPH
float_precision: 2
type: line
color: red
group_by:
func: avg
duration: 1h
show:
extremas: true