mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-21 08:16:36 +00:00
Bring back energy usage graph order (#24156)
This commit is contained in:
parent
a26bf80b13
commit
3d5c65d652
@ -300,6 +300,8 @@ export class HuiEnergyUsageGraphCard
|
|||||||
type: "bar",
|
type: "bar",
|
||||||
stack: "usage",
|
stack: "usage",
|
||||||
data: [],
|
data: [],
|
||||||
|
// @ts-expect-error
|
||||||
|
order: 0,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -315,6 +317,8 @@ export class HuiEnergyUsageGraphCard
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
// @ts-expect-error
|
||||||
|
datasets.sort((a, b) => a.order - b.order);
|
||||||
fillDataGapsAndRoundCaps(datasets);
|
fillDataGapsAndRoundCaps(datasets);
|
||||||
this._chartData = datasets;
|
this._chartData = datasets;
|
||||||
}
|
}
|
||||||
@ -482,7 +486,7 @@ export class HuiEnergyUsageGraphCard
|
|||||||
this._compareStart!
|
this._compareStart!
|
||||||
);
|
);
|
||||||
|
|
||||||
Object.entries(combinedData).forEach(([type, sources]) => {
|
Object.entries(combinedData).forEach(([type, sources], idx) => {
|
||||||
Object.entries(sources).forEach(([statId, source]) => {
|
Object.entries(sources).forEach(([statId, source]) => {
|
||||||
const points: BarSeriesOption["data"] = [];
|
const points: BarSeriesOption["data"] = [];
|
||||||
// Process chart data.
|
// Process chart data.
|
||||||
@ -513,6 +517,13 @@ export class HuiEnergyUsageGraphCard
|
|||||||
statId,
|
statId,
|
||||||
statisticsMetaData[statId]
|
statisticsMetaData[statId]
|
||||||
),
|
),
|
||||||
|
// @ts-expect-error
|
||||||
|
order:
|
||||||
|
type === "used_solar"
|
||||||
|
? 1
|
||||||
|
: type === "to_battery"
|
||||||
|
? Object.keys(combinedData).length
|
||||||
|
: idx + 2,
|
||||||
barMaxWidth: 50,
|
barMaxWidth: 50,
|
||||||
itemStyle: {
|
itemStyle: {
|
||||||
borderColor: getEnergyColor(
|
borderColor: getEnergyColor(
|
||||||
|
Loading…
x
Reference in New Issue
Block a user