mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-25 18:26:35 +00:00
fix history graph configuration timeline update (#14101)
This commit is contained in:
parent
dec8883f2a
commit
23f8373b16
@ -118,6 +118,25 @@ export class StateHistoryChartTimeline extends LitElement {
|
||||
|
||||
public willUpdate(changedProps: PropertyValues) {
|
||||
if (!this.hasUpdated) {
|
||||
this._createOptions();
|
||||
}
|
||||
|
||||
if (
|
||||
changedProps.has("data") ||
|
||||
this._chartTime <
|
||||
new Date(this.endTime.getTime() - MIN_TIME_BETWEEN_UPDATES)
|
||||
) {
|
||||
// If the line is more than 5 minutes old, re-gen it
|
||||
// so the X axis grows even if there is no new data
|
||||
this._generateData();
|
||||
}
|
||||
|
||||
if (changedProps.has("startTime") || changedProps.has("endTime")) {
|
||||
this._createOptions();
|
||||
}
|
||||
}
|
||||
|
||||
private _createOptions() {
|
||||
const narrow = this.narrow;
|
||||
this._chartOptions = {
|
||||
maintainAspectRatio: false,
|
||||
@ -213,16 +232,6 @@ export class StateHistoryChartTimeline extends LitElement {
|
||||
locale: numberFormatToLocale(this.hass.locale),
|
||||
};
|
||||
}
|
||||
if (
|
||||
changedProps.has("data") ||
|
||||
this._chartTime <
|
||||
new Date(this.endTime.getTime() - MIN_TIME_BETWEEN_UPDATES)
|
||||
) {
|
||||
// If the line is more than 5 minutes old, re-gen it
|
||||
// so the X axis grows even if there is no new data
|
||||
this._generateData();
|
||||
}
|
||||
}
|
||||
|
||||
private _generateData() {
|
||||
const computedStyles = getComputedStyle(this);
|
||||
|
Loading…
x
Reference in New Issue
Block a user