Restore correct default legend behavior for history graph card (#14612)

fixes undefined
This commit is contained in:
Philip Allgaier 2022-12-08 11:34:13 +01:00 committed by GitHub
parent efda2ab626
commit 34e1d745be
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 9 additions and 3 deletions

View File

@ -47,7 +47,7 @@ class StateHistoryChartLine extends LitElement {
} }
public willUpdate(changedProps: PropertyValues) { public willUpdate(changedProps: PropertyValues) {
if (!this.hasUpdated) { if (!this.hasUpdated || changedProps.has("showNames")) {
this._chartOptions = { this._chartOptions = {
parsing: false, parsing: false,
animation: false, animation: false,

View File

@ -64,7 +64,11 @@ export class StateHistoryChartTimeline extends LitElement {
this._generateData(); this._generateData();
} }
if (changedProps.has("startTime") || changedProps.has("endTime")) { if (
changedProps.has("startTime") ||
changedProps.has("endTime") ||
changedProps.has("showNames")
) {
this._createOptions(); this._createOptions();
} }
} }

View File

@ -144,7 +144,9 @@ export class HuiHistoryGraphCard extends LitElement implements LovelaceCard {
.historyData=${this._stateHistory} .historyData=${this._stateHistory}
.names=${this._names} .names=${this._names}
up-to-now up-to-now
.showNames=${this._config.show_names} .showNames=${this._config.show_names !== undefined
? this._config.show_names
: true}
></state-history-charts> ></state-history-charts>
</div> </div>
</ha-card> </ha-card>