1
0
mirror of https://github.com/home-assistant/frontend.git synced 2025-12-20 02:38:53 +00:00

fix stacking of multiple power sources (#28243)

This commit is contained in:
eringerli
2025-12-01 07:25:47 +01:00
committed by GitHub
parent 28a89ff9e6
commit c13bece6d0

View File

@@ -323,9 +323,9 @@ export class HuiPowerSourcesGraphCard
const negative: [number, number][] = []; const negative: [number, number][] = [];
Object.entries(data).forEach(([x, y]) => { Object.entries(data).forEach(([x, y]) => {
const ts = Number(x); const ts = Number(x);
const meanY = y.reduce((a, b) => a + b, 0) / y.length; const sumY = y.reduce((a, b) => a + b, 0);
positive.push([ts, Math.max(0, meanY)]); positive.push([ts, Math.max(0, sumY)]);
negative.push([ts, Math.min(0, meanY)]); negative.push([ts, Math.min(0, sumY)]);
}); });
return { positive, negative }; return { positive, negative };
} }