Fix devices graph max_devices (#25406)

This commit is contained in:
karwosts 2025-05-09 09:35:54 -07:00 committed by Bram Kragten
parent c00b4120ab
commit 724df18175

View File

@ -244,7 +244,10 @@ export class HuiEnergyDevicesGraphCard
chartData.sort((a: any, b: any) => b.value[0] - a.value[0]); chartData.sort((a: any, b: any) => b.value[0] - a.value[0]);
chartData.length = this._config?.max_devices || chartData.length; chartData.length = Math.min(
this._config?.max_devices || Infinity,
chartData.length
);
this._chartData = datasets; this._chartData = datasets;
await this.updateComplete; await this.updateComplete;