Skip to content

hd-price-bars

Attributes and example

hd-price-bars

Electricity prices as bars in their colours, cheap to expensive on each day’s own range (cheap, normal, expensive; below zero its own colour, drawn under the zero line), the slot now marked and the past dimmed. A band can mark the cheapest hours (highlight-*), a bracket another stretch, like a car’s charging (mark-*); slots not published yet (tomorrow before ~13:00) wait as a dashed outline with pending on it. Hover or tap a bar to read its price. The colours follow the theme (--hd-price-*), as greys on e-ink. Bars grow in at full motion only. For today and tomorrow: values="{{ prices.bars.values }}" start="{{ prices.bars.start }}" step="{{ prices.bars.step }}" now="{{ prices.now.start }}".

AttributeWhat it is
valuesrequiredThe prices per slot, separated by commas, e.g. {{ prices.bars.values }} or {{ prices.today.values }}.
levelsEach slot’s level (negative, cheap, normal, high), separated by commas, e.g. {{ prices.bars.levels }}, so the colours are the ones the rest of the widget says; worked out from the values (against each day’s average) when left out.
startWhen the first slot starts (ISO), e.g. {{ prices.bars.start }}.
stepMinutes per slot: 60, or 15.Default 60.
slotsHow many slots to make room for; past the values they wait for their prices (tomorrow’s 24 before they are out).
pendingSaid over the slots still waiting, e.g. {{ prices.bars.pending }}.
nowThe moment now (ISO); its slot is marked, the ones before dimmed. Defaults to the clock.
fromShow from this moment (ISO) on, e.g. {{ prices.now.start }}, instead of from start.
spanHours to show from from; all by default.
highlight-fromStart of a band behind the bars (ISO), e.g. the cheapest hours.
highlight-toEnd of the band (ISO).
highlight-labelSaid on the band, e.g. “Cheapest 3 h”.
mark-fromStart of a bracket under the bars (ISO), e.g. when the car charged.
mark-toEnd of the bracket (ISO).
mark-labelSaid by the bracket, e.g. “Charged”.
currencySymbol for the prices read out, e.g. €.Default €.
time-zoneThe clock the hours are told by, e.g. {{ prices.timeZone }}; the screen’s by default.
compactNo hour labels or read-out: bars only, for small spaces.Default false.
<hd-price-bars values="{{ prices.bars.values }}" levels="{{ prices.bars.levels }}" start="{{ prices.bars.start }}" step="{{ prices.bars.step }}" now="{{ prices.now.start }}" slots="{{ prices.bars.slots }}" pending="{{ prices.bars.pending }}"></hd-price-bars>

Styling

Set CSS variables on the component element. Its internal elements live in Shadow DOM; only the exposed named parts can be styled with ::part.

No component-specific CSS variables are exposed. Use the host element’s sizing and the documented theme variables.

Exposed parts

hd-price-bars::part(chart) {  /* Your styles */}

Style the host

hd-price-bars {  --hd-accent: #2563eb;  max-width: 100%;}
Theme variables