Remove interpolation from history graph (#11498)

This commit is contained in:
Bram Kragten 2022-01-31 18:07:00 +01:00 committed by GitHub
parent ce99d14ee0
commit 182ffccd0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -183,12 +183,7 @@ class StateHistoryChartLine extends LitElement {
prevValues = datavalues;
};
const addDataSet = (
nameY: string,
step = false,
fill = false,
color?: string
) => {
const addDataSet = (nameY: string, fill = false, color?: string) => {
if (!color) {
color = getGraphColorByIndex(colorIndex, computedStyles);
colorIndex++;
@ -198,7 +193,7 @@ class StateHistoryChartLine extends LitElement {
fill: fill ? "origin" : false,
borderColor: color,
backgroundColor: color + "7F",
stepped: step ? "before" : false,
stepped: "before",
pointRadius: 0,
data: [],
});
@ -239,14 +234,12 @@ class StateHistoryChartLine extends LitElement {
addDataSet(
`${this.hass.localize("ui.card.climate.current_temperature", {
name: name,
})}`,
true
})}`
);
if (hasHeat) {
addDataSet(
`${this.hass.localize("ui.card.climate.heating", { name: name })}`,
true,
true,
computedStyles.getPropertyValue("--state-climate-heat-color")
);
// The "heating" series uses steppedArea to shade the area below the current
@ -256,7 +249,6 @@ class StateHistoryChartLine extends LitElement {
addDataSet(
`${this.hass.localize("ui.card.climate.cooling", { name: name })}`,
true,
true,
computedStyles.getPropertyValue("--state-climate-cool-color")
);
// The "cooling" series uses steppedArea to shade the area below the current
@ -268,22 +260,19 @@ class StateHistoryChartLine extends LitElement {
`${this.hass.localize("ui.card.climate.target_temperature_mode", {
name: name,
mode: this.hass.localize("ui.card.climate.high"),
})}`,
true
})}`
);
addDataSet(
`${this.hass.localize("ui.card.climate.target_temperature_mode", {
name: name,
mode: this.hass.localize("ui.card.climate.low"),
})}`,
true
})}`
);
} else {
addDataSet(
`${this.hass.localize("ui.card.climate.target_temperature_entity", {
name: name,
})}`,
true
})}`
);
}
@ -318,14 +307,12 @@ class StateHistoryChartLine extends LitElement {
addDataSet(
`${this.hass.localize("ui.card.humidifier.target_humidity_entity", {
name: name,
})}`,
true
})}`
);
addDataSet(
`${this.hass.localize("ui.card.humidifier.on_entity", {
name: name,
})}`,
true,
true
);
@ -337,9 +324,7 @@ class StateHistoryChartLine extends LitElement {
pushData(new Date(entityState.last_changed), series);
});
} else {
// Only interpolate for sensors
const isStep = domain !== "sensor";
addDataSet(name, isStep);
addDataSet(name);
let lastValue: number;
let lastDate: Date;