mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-26 18:56:39 +00:00
Show statistics bands when charting min/max only (#17549)
This commit is contained in:
parent
3f05712c18
commit
fa3625985c
@ -329,8 +329,14 @@ class StatisticsChart extends LitElement {
|
|||||||
|
|
||||||
const statTypes: this["statTypes"] = [];
|
const statTypes: this["statTypes"] = [];
|
||||||
|
|
||||||
const drawBands =
|
const hasMean =
|
||||||
this.statTypes.includes("mean") && statisticsHaveType(stats, "mean");
|
this.statTypes.includes("mean") && statisticsHaveType(stats, "mean");
|
||||||
|
const drawBands =
|
||||||
|
hasMean ||
|
||||||
|
(this.statTypes.includes("min") &&
|
||||||
|
statisticsHaveType(stats, "min") &&
|
||||||
|
this.statTypes.includes("max") &&
|
||||||
|
statisticsHaveType(stats, "max"));
|
||||||
|
|
||||||
const sortedTypes = drawBands
|
const sortedTypes = drawBands
|
||||||
? [...this.statTypes].sort((a, b) => {
|
? [...this.statTypes].sort((a, b) => {
|
||||||
@ -358,13 +364,14 @@ class StatisticsChart extends LitElement {
|
|||||||
`ui.components.statistics_charts.statistic_types.${type}`
|
`ui.components.statistics_charts.statistic_types.${type}`
|
||||||
),
|
),
|
||||||
fill: drawBands
|
fill: drawBands
|
||||||
? type === "min"
|
? type === "min" && hasMean
|
||||||
? "+1"
|
? "+1"
|
||||||
: type === "max"
|
: type === "max"
|
||||||
? "-1"
|
? "-1"
|
||||||
: false
|
: false
|
||||||
: false,
|
: false,
|
||||||
borderColor: band ? color + (this.hideLegend ? "00" : "7F") : color,
|
borderColor:
|
||||||
|
band && hasMean ? color + (this.hideLegend ? "00" : "7F") : color,
|
||||||
backgroundColor: band ? color + "3F" : color + "7F",
|
backgroundColor: band ? color + "3F" : color + "7F",
|
||||||
pointRadius: 0,
|
pointRadius: 0,
|
||||||
data: [],
|
data: [],
|
||||||
|
Loading…
x
Reference in New Issue
Block a user