mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Sort tooltips in energy graphs and filter zeros (#17057)
This commit is contained in:
parent
ce9380e4d7
commit
5ac9a6c9cc
@ -217,6 +217,10 @@ export class HuiEnergyGasGraphCard
|
||||
plugins: {
|
||||
tooltip: {
|
||||
position: "nearest",
|
||||
filter: (val) => val.formattedValue !== "0",
|
||||
itemSort: function (a, b) {
|
||||
return b.datasetIndex - a.datasetIndex;
|
||||
},
|
||||
callbacks: {
|
||||
title: (datasets) => {
|
||||
if (dayDifference > 0) {
|
||||
|
@ -213,6 +213,10 @@ export class HuiEnergySolarGraphCard
|
||||
plugins: {
|
||||
tooltip: {
|
||||
position: "nearest",
|
||||
filter: (val) => val.formattedValue !== "0",
|
||||
itemSort: function (a, b) {
|
||||
return b.datasetIndex - a.datasetIndex;
|
||||
},
|
||||
callbacks: {
|
||||
title: (datasets) => {
|
||||
if (dayDifference > 0) {
|
||||
|
@ -209,6 +209,18 @@ export class HuiEnergyUsageGraphCard
|
||||
tooltip: {
|
||||
position: "nearest",
|
||||
filter: (val) => val.formattedValue !== "0",
|
||||
itemSort: function (a: any, b: any) {
|
||||
if (a.raw?.y > 0 && b.raw?.y < 0) {
|
||||
return -1;
|
||||
}
|
||||
if (b.raw?.y > 0 && a.raw?.y < 0) {
|
||||
return 1;
|
||||
}
|
||||
if (a.raw?.y > 0) {
|
||||
return b.datasetIndex - a.datasetIndex;
|
||||
}
|
||||
return a.datasetIndex - b.datasetIndex;
|
||||
},
|
||||
callbacks: {
|
||||
title: (datasets) => {
|
||||
if (dayDifference > 0) {
|
||||
|
@ -217,6 +217,10 @@ export class HuiEnergyWaterGraphCard
|
||||
plugins: {
|
||||
tooltip: {
|
||||
position: "nearest",
|
||||
filter: (val) => val.formattedValue !== "0",
|
||||
itemSort: function (a, b) {
|
||||
return b.datasetIndex - a.datasetIndex;
|
||||
},
|
||||
callbacks: {
|
||||
title: (datasets) => {
|
||||
if (dayDifference > 0) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user