mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-27 03:06:41 +00:00
Don't show fractions in energy percentage gauges (#17140)
This commit is contained in:
parent
0735b6475a
commit
21caac4240
@ -21,6 +21,10 @@ import type { LovelaceCard } from "../../types";
|
|||||||
import { severityMap } from "../hui-gauge-card";
|
import { severityMap } from "../hui-gauge-card";
|
||||||
import type { EnergyCarbonGaugeCardConfig } from "../types";
|
import type { EnergyCarbonGaugeCardConfig } from "../types";
|
||||||
|
|
||||||
|
const FORMAT_OPTIONS = {
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
};
|
||||||
|
|
||||||
@customElement("hui-energy-carbon-consumed-gauge-card")
|
@customElement("hui-energy-carbon-consumed-gauge-card")
|
||||||
class HuiEnergyCarbonGaugeCard
|
class HuiEnergyCarbonGaugeCard
|
||||||
extends SubscribeMixin(LitElement)
|
extends SubscribeMixin(LitElement)
|
||||||
@ -129,6 +133,7 @@ class HuiEnergyCarbonGaugeCard
|
|||||||
min="0"
|
min="0"
|
||||||
max="100"
|
max="100"
|
||||||
.value=${value}
|
.value=${value}
|
||||||
|
.formatOptions=${FORMAT_OPTIONS}
|
||||||
.locale=${this.hass.locale}
|
.locale=${this.hass.locale}
|
||||||
label="%"
|
label="%"
|
||||||
style=${styleMap({
|
style=${styleMap({
|
||||||
|
@ -19,6 +19,10 @@ import type { LovelaceCard } from "../../types";
|
|||||||
import { severityMap } from "../hui-gauge-card";
|
import { severityMap } from "../hui-gauge-card";
|
||||||
import type { EnergySelfSufficiencyGaugeCardConfig } from "../types";
|
import type { EnergySelfSufficiencyGaugeCardConfig } from "../types";
|
||||||
|
|
||||||
|
const FORMAT_OPTIONS = {
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
};
|
||||||
|
|
||||||
@customElement("hui-energy-self-sufficiency-gauge-card")
|
@customElement("hui-energy-self-sufficiency-gauge-card")
|
||||||
class HuiEnergySelfSufficiencyGaugeCard
|
class HuiEnergySelfSufficiencyGaugeCard
|
||||||
extends SubscribeMixin(LitElement)
|
extends SubscribeMixin(LitElement)
|
||||||
@ -174,8 +178,9 @@ class HuiEnergySelfSufficiencyGaugeCard
|
|||||||
min="0"
|
min="0"
|
||||||
max="100"
|
max="100"
|
||||||
.value=${value}
|
.value=${value}
|
||||||
.locale=${this.hass.locale}
|
|
||||||
label="%"
|
label="%"
|
||||||
|
.formatOptions=${FORMAT_OPTIONS}
|
||||||
|
.locale=${this.hass.locale}
|
||||||
style=${styleMap({
|
style=${styleMap({
|
||||||
"--gauge-color": this._computeSeverity(value),
|
"--gauge-color": this._computeSeverity(value),
|
||||||
})}
|
})}
|
||||||
|
@ -19,6 +19,10 @@ import type { LovelaceCard } from "../../types";
|
|||||||
import { severityMap } from "../hui-gauge-card";
|
import { severityMap } from "../hui-gauge-card";
|
||||||
import type { EnergySolarGaugeCardConfig } from "../types";
|
import type { EnergySolarGaugeCardConfig } from "../types";
|
||||||
|
|
||||||
|
const FORMAT_OPTIONS = {
|
||||||
|
maximumFractionDigits: 0,
|
||||||
|
};
|
||||||
|
|
||||||
@customElement("hui-energy-solar-consumed-gauge-card")
|
@customElement("hui-energy-solar-consumed-gauge-card")
|
||||||
class HuiEnergySolarGaugeCard
|
class HuiEnergySolarGaugeCard
|
||||||
extends SubscribeMixin(LitElement)
|
extends SubscribeMixin(LitElement)
|
||||||
@ -109,8 +113,9 @@ class HuiEnergySolarGaugeCard
|
|||||||
min="0"
|
min="0"
|
||||||
max="100"
|
max="100"
|
||||||
.value=${value}
|
.value=${value}
|
||||||
.locale=${this.hass.locale}
|
|
||||||
label="%"
|
label="%"
|
||||||
|
.formatOptions=${FORMAT_OPTIONS}
|
||||||
|
.locale=${this.hass.locale}
|
||||||
style=${styleMap({
|
style=${styleMap({
|
||||||
"--gauge-color": this._computeSeverity(value),
|
"--gauge-color": this._computeSeverity(value),
|
||||||
})}
|
})}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user