mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 02:36:37 +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) {
|
public willUpdate(changedProps: PropertyValues) {
|
||||||
if (!this.hasUpdated) {
|
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;
|
const narrow = this.narrow;
|
||||||
this._chartOptions = {
|
this._chartOptions = {
|
||||||
maintainAspectRatio: false,
|
maintainAspectRatio: false,
|
||||||
@ -213,16 +232,6 @@ export class StateHistoryChartTimeline extends LitElement {
|
|||||||
locale: numberFormatToLocale(this.hass.locale),
|
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() {
|
private _generateData() {
|
||||||
const computedStyles = getComputedStyle(this);
|
const computedStyles = getComputedStyle(this);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user