Last active
November 14, 2023 21:04
-
-
Save svenakela/e6328f35f97743fc665a46804b732806 to your computer and use it in GitHub Desktop.
Home Assistant apexcharts-card 48 h Nordpool
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Example screenshot: | |
- type: custom:apexcharts-card | |
graph_span: 48h | |
header: | |
title: Elpris (kr/kWh) | |
show: true | |
experimental: | |
color_threshold: true | |
all_series_config: | |
stroke_width: 1 | |
color_threshold: | |
- value: -0.3 | |
color: 37FF00 | |
- value: 0.3 | |
color: 0080FF | |
- value: 1.5 | |
color: FF0033 | |
apex_config: | |
responsive: | |
- breakpoint: 400 | |
options: | |
chart: | |
height: 200px | |
- breakpoint: 800 | |
options: | |
chart: | |
height: 360px | |
- breakpoint: 10000 | |
options: | |
chart: | |
height: 600px | |
span: | |
start: day | |
now: | |
show: true | |
label: Just nu | |
color: fff700 | |
series: | |
- entity: sensor.nordpool_kwh_se3_sek_3_10_025 | |
type: area | |
curve: stepline | |
float_precision: 3 | |
extend_to: now | |
data_generator: > | |
let td = entity.attributes.raw_today; | |
let tm = entity.attributes.raw_tomorrow; | |
const repeatLast = (x) => [new Date(x.at(-1)[0]).getTime()+3600000, x.at(-1)[1]]; | |
let dataset = [ | |
...td.map((data, index) => { | |
return [data["start"], data["value"]]; | |
}), | |
...tm.map((data, index) => { | |
return [data["start"], data["value"]]; | |
}) | |
]; | |
return [...dataset, repeatLast(dataset)]; | |
color: fff |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment