mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-20 15:56:35 +00:00
Remove interpolation from history graph (#11498)
This commit is contained in:
parent
ce99d14ee0
commit
182ffccd0c
@ -183,12 +183,7 @@ class StateHistoryChartLine extends LitElement {
|
|||||||
prevValues = datavalues;
|
prevValues = datavalues;
|
||||||
};
|
};
|
||||||
|
|
||||||
const addDataSet = (
|
const addDataSet = (nameY: string, fill = false, color?: string) => {
|
||||||
nameY: string,
|
|
||||||
step = false,
|
|
||||||
fill = false,
|
|
||||||
color?: string
|
|
||||||
) => {
|
|
||||||
if (!color) {
|
if (!color) {
|
||||||
color = getGraphColorByIndex(colorIndex, computedStyles);
|
color = getGraphColorByIndex(colorIndex, computedStyles);
|
||||||
colorIndex++;
|
colorIndex++;
|
||||||
@ -198,7 +193,7 @@ class StateHistoryChartLine extends LitElement {
|
|||||||
fill: fill ? "origin" : false,
|
fill: fill ? "origin" : false,
|
||||||
borderColor: color,
|
borderColor: color,
|
||||||
backgroundColor: color + "7F",
|
backgroundColor: color + "7F",
|
||||||
stepped: step ? "before" : false,
|
stepped: "before",
|
||||||
pointRadius: 0,
|
pointRadius: 0,
|
||||||
data: [],
|
data: [],
|
||||||
});
|
});
|
||||||
@ -239,14 +234,12 @@ class StateHistoryChartLine extends LitElement {
|
|||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.climate.current_temperature", {
|
`${this.hass.localize("ui.card.climate.current_temperature", {
|
||||||
name: name,
|
name: name,
|
||||||
})}`,
|
})}`
|
||||||
true
|
|
||||||
);
|
);
|
||||||
if (hasHeat) {
|
if (hasHeat) {
|
||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.climate.heating", { name: name })}`,
|
`${this.hass.localize("ui.card.climate.heating", { name: name })}`,
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
computedStyles.getPropertyValue("--state-climate-heat-color")
|
computedStyles.getPropertyValue("--state-climate-heat-color")
|
||||||
);
|
);
|
||||||
// The "heating" series uses steppedArea to shade the area below the current
|
// The "heating" series uses steppedArea to shade the area below the current
|
||||||
@ -256,7 +249,6 @@ class StateHistoryChartLine extends LitElement {
|
|||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.climate.cooling", { name: name })}`,
|
`${this.hass.localize("ui.card.climate.cooling", { name: name })}`,
|
||||||
true,
|
true,
|
||||||
true,
|
|
||||||
computedStyles.getPropertyValue("--state-climate-cool-color")
|
computedStyles.getPropertyValue("--state-climate-cool-color")
|
||||||
);
|
);
|
||||||
// The "cooling" series uses steppedArea to shade the area below the current
|
// 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", {
|
`${this.hass.localize("ui.card.climate.target_temperature_mode", {
|
||||||
name: name,
|
name: name,
|
||||||
mode: this.hass.localize("ui.card.climate.high"),
|
mode: this.hass.localize("ui.card.climate.high"),
|
||||||
})}`,
|
})}`
|
||||||
true
|
|
||||||
);
|
);
|
||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.climate.target_temperature_mode", {
|
`${this.hass.localize("ui.card.climate.target_temperature_mode", {
|
||||||
name: name,
|
name: name,
|
||||||
mode: this.hass.localize("ui.card.climate.low"),
|
mode: this.hass.localize("ui.card.climate.low"),
|
||||||
})}`,
|
})}`
|
||||||
true
|
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.climate.target_temperature_entity", {
|
`${this.hass.localize("ui.card.climate.target_temperature_entity", {
|
||||||
name: name,
|
name: name,
|
||||||
})}`,
|
})}`
|
||||||
true
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -318,14 +307,12 @@ class StateHistoryChartLine extends LitElement {
|
|||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.humidifier.target_humidity_entity", {
|
`${this.hass.localize("ui.card.humidifier.target_humidity_entity", {
|
||||||
name: name,
|
name: name,
|
||||||
})}`,
|
})}`
|
||||||
true
|
|
||||||
);
|
);
|
||||||
addDataSet(
|
addDataSet(
|
||||||
`${this.hass.localize("ui.card.humidifier.on_entity", {
|
`${this.hass.localize("ui.card.humidifier.on_entity", {
|
||||||
name: name,
|
name: name,
|
||||||
})}`,
|
})}`,
|
||||||
true,
|
|
||||||
true
|
true
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -337,9 +324,7 @@ class StateHistoryChartLine extends LitElement {
|
|||||||
pushData(new Date(entityState.last_changed), series);
|
pushData(new Date(entityState.last_changed), series);
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
// Only interpolate for sensors
|
addDataSet(name);
|
||||||
const isStep = domain !== "sensor";
|
|
||||||
addDataSet(name, isStep);
|
|
||||||
|
|
||||||
let lastValue: number;
|
let lastValue: number;
|
||||||
let lastDate: Date;
|
let lastDate: Date;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user