Show statistics bands when charting min/max only (#17549)

This commit is contained in:
karwosts 2023-08-14 00:52:38 -07:00 committed by GitHub
parent 3f05712c18
commit fa3625985c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -329,8 +329,14 @@ class StatisticsChart extends LitElement {
const statTypes: this["statTypes"] = [];
const drawBands =
const hasMean =
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
? [...this.statTypes].sort((a, b) => {
@ -358,13 +364,14 @@ class StatisticsChart extends LitElement {
`ui.components.statistics_charts.statistic_types.${type}`
),
fill: drawBands
? type === "min"
? type === "min" && hasMean
? "+1"
: type === "max"
? "-1"
: 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",
pointRadius: 0,
data: [],