Hi,
I use apexcharts-card for showing dynamic prices:
in the legend of the chart is shown the last value of the Preis : Preis: 0,3033 €/kWh. How can I change this to the value of the actual time (markted with “Jetzt”)?
The code of the chart is:
type: custom:apexcharts-card
graph_span: 23h
grid_options:
columns: 18
rows: 8
span:
start: hour
offset: "-1h"
now:
show: true
label: Jetzt
header:
title: Strompreis(€/kWh) heute
show: true
apex_config:
xaxis:
type: datetime
labels:
datetimeFormatter:
hour: HH:mm
day: dd MMM
plotOptions:
bar:
colors:
ranges:
- from: 0
to: 0.15
color: "#2ecc71"
- from: 0.15
to: 0.2
color: "#a6d96a"
- from: 0.2
to: 0.25
color: "#f7f714"
- from: 0.25
to: 0.3
color: "#fdae61"
- from: 0.3
to: 0.35
color: "#f46d43"
- from: 0.35
to: 1
color: "#d73027"
series:
- entity: sensor.ostrom_energy_spotpreis
attribute: prices
float_precision: 4
stroke_width: 8
type: column
name: Preis
data_generator: |
const prices = entity.attributes.prices;
return Object.entries(prices).map(([timestamp, value]) => {
const date = new Date(timestamp);
return [date, value];
});
show:
datalabels: false
in_header: true
- entity: sensor.ostrom_energy_durchschnittspreis
float_precision: 4
stroke_width: 2
yaxis:
- min: "|-0.01|"
max: auto
decimals: 3
