mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-28 03:36:44 +00:00
parent
0a41a4f066
commit
2c58a9f802
@ -27,6 +27,8 @@ import { SensorCardConfig } from "./types";
|
|||||||
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
import { hasConfigOrEntityChanged } from "../common/has-changed";
|
||||||
import { actionHandler } from "../common/directives/action-handler-directive";
|
import { actionHandler } from "../common/directives/action-handler-directive";
|
||||||
|
|
||||||
|
const strokeWidth = 5;
|
||||||
|
|
||||||
const average = (items): number => {
|
const average = (items): number => {
|
||||||
return (
|
return (
|
||||||
items.reduce((sum, entry) => sum + parseFloat(entry.state), 0) /
|
items.reduce((sum, entry) => sum + parseFloat(entry.state), 0) /
|
||||||
@ -101,7 +103,8 @@ const calcPoints = (
|
|||||||
if (item) {
|
if (item) {
|
||||||
last = [average(item), lastValue(item)];
|
last = [average(item), lastValue(item)];
|
||||||
}
|
}
|
||||||
const y = height - ((item ? last[0] : last[1]) - min) / yRatio;
|
const y =
|
||||||
|
height + strokeWidth / 2 - ((item ? last[0] : last[1]) - min) / yRatio;
|
||||||
return coords.push([x, y]);
|
return coords.push([x, y]);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -257,7 +260,7 @@ class HuiSensorCard extends LitElement implements LovelaceCard {
|
|||||||
<path
|
<path
|
||||||
fill="none"
|
fill="none"
|
||||||
stroke="var(--accent-color)"
|
stroke="var(--accent-color)"
|
||||||
stroke-width="5"
|
stroke-width="${strokeWidth}"
|
||||||
stroke-linecap="round"
|
stroke-linecap="round"
|
||||||
stroke-linejoin="round"
|
stroke-linejoin="round"
|
||||||
d=${this._history}
|
d=${this._history}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user