mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-15 21:36:36 +00:00
Fix tooltip and click action on device energy graph (#10094)
This commit is contained in:
parent
b6344eb6e8
commit
68095417b9
@ -130,6 +130,10 @@ export class HuiEnergyDevicesGraphCard
|
|||||||
tooltip: {
|
tooltip: {
|
||||||
mode: "nearest",
|
mode: "nearest",
|
||||||
callbacks: {
|
callbacks: {
|
||||||
|
title: (item) => {
|
||||||
|
const entity = this.hass.states[item[0].label];
|
||||||
|
return entity ? computeStateName(entity) : item[0].label;
|
||||||
|
},
|
||||||
label: (context) =>
|
label: (context) =>
|
||||||
`${context.dataset.label}: ${formatNumber(
|
`${context.dataset.label}: ${formatNumber(
|
||||||
context.parsed.x,
|
context.parsed.x,
|
||||||
@ -149,7 +153,7 @@ export class HuiEnergyDevicesGraphCard
|
|||||||
);
|
);
|
||||||
fireEvent(this, "hass-more-info", {
|
fireEvent(this, "hass-more-info", {
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
entityId: this._chartData?.datasets[0]?.data[index]?.label,
|
entityId: this._chartData?.datasets[0]?.data[index]?.y,
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
Loading…
x
Reference in New Issue
Block a user