Skip to content

Commit

Permalink
Use 1dp for energy flow labels
Browse files Browse the repository at this point in the history
  • Loading branch information
davet2001 committed Oct 29, 2024
1 parent a090fcb commit 3ecd1b5
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/ha-elec-sankey.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ export class HaElecSankey extends ElecSankey {
valueB: number | undefined
): TemplateResult {
const _id = id || "";
const numFractionDigits = this.unit === "kWh" ? 1 : 0;
return html`
<div
class=${id ? "label label-action-clickable" : "label"}
Expand All @@ -51,18 +52,18 @@ export class HaElecSankey extends ElecSankey {
<ha-svg-icon id=${_id} class="small" .path=${mdiArrowLeft}>
</ha-svg-icon
>${formatNumber(valueB, this.hass.locale, {
maximumFractionDigits: 0,
maximumFractionDigits: numFractionDigits,
})}&nbsp;${this.unit}</span
><br />
<span class="consumption" id=${_id}>
<ha-svg-icon id=${_id} class="small" .path=${mdiArrowRight}>
</ha-svg-icon
>${formatNumber(valueA, this.hass.locale, {
maximumFractionDigits: 0,
maximumFractionDigits: numFractionDigits,
})}&nbsp;${this.unit}
</span>`
: html`<br />${formatNumber(valueA, this.hass.locale, {
maximumFractionDigits: 0,
maximumFractionDigits: numFractionDigits,
})}&nbsp;${this.unit}`}</div>`;
}

Expand Down

0 comments on commit 3ecd1b5

Please sign in to comment.