mirror of
https://github.com/kalkih/mini-graph-card.git
synced 2025-12-20 00:35:56 +01:00
fix: process absent UoM in computeLegend() (#1237)
This commit is contained in:
11
src/main.js
11
src/main.js
@@ -356,11 +356,14 @@ class MiniGraphCard extends LitElement {
|
||||
const { show_legend_state = false } = this.config.entities[index];
|
||||
|
||||
if (show_legend_state) {
|
||||
if (this.computeUom(index) === '%') {
|
||||
legend += ` (${this.computeState(state)}${this.computeUom(index)})`;
|
||||
} else {
|
||||
legend += ` (${this.computeState(state)} ${this.computeUom(index)})`;
|
||||
legend += ` (${this.computeState(state)}`;
|
||||
if (!(['unavailable'].includes(state))) {
|
||||
const uom = this.computeUom(index);
|
||||
if (!(['%', ''].includes(uom)))
|
||||
legend += ' ';
|
||||
legend += `${uom}`;
|
||||
}
|
||||
legend += ')';
|
||||
}
|
||||
|
||||
return legend;
|
||||
|
||||
Reference in New Issue
Block a user