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:
@@ -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 };
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user