diff --git a/src/components/chart/statistics-chart.ts b/src/components/chart/statistics-chart.ts index 8a597fd56a..b1f3be804d 100644 --- a/src/components/chart/statistics-chart.ts +++ b/src/components/chart/statistics-chart.ts @@ -253,7 +253,7 @@ class StatisticsChart extends LitElement { const firstStat = stats[0]; const meta = statisticsMetaData?.[firstStat.statistic_id]; let name = names[firstStat.statistic_id]; - if (!name) { + if (name === undefined) { name = getStatisticLabel(this.hass, firstStat.statistic_id, meta); } @@ -324,10 +324,14 @@ class StatisticsChart extends LitElement { const band = drawBands && (type === "min" || type === "max"); statTypes.push(type); statDataSets.push({ - label: `${name} (${this.hass.localize( - `ui.components.statistics_charts.statistic_types.${type}` - )}) - `, + label: name + ? `${name} (${this.hass.localize( + `ui.components.statistics_charts.statistic_types.${type}` + )}) + ` + : this.hass.localize( + `ui.components.statistics_charts.statistic_types.${type}` + ), fill: drawBands ? type === "min" ? "+1" diff --git a/src/dialogs/more-info/ha-more-info-history.ts b/src/dialogs/more-info/ha-more-info-history.ts index 43eaa9fd84..679d0914a1 100644 --- a/src/dialogs/more-info/ha-more-info-history.ts +++ b/src/dialogs/more-info/ha-more-info-history.ts @@ -36,6 +36,8 @@ export class MoreInfoHistory extends LitElement { private _showMoreHref = ""; + private _statNames?: Record; + private _throttleGetStateHistory = throttle(() => { this._getStateHistory(); }, 10000); @@ -62,6 +64,7 @@ export class MoreInfoHistory extends LitElement { .isLoadingData=${!this._statistics} .statisticsData=${this._statistics} .statTypes=${statTypes} + .names=${this._statNames} >` : html`