Skip to content

armgit / core

Public Imported from GitHub
0

100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps

UI Bugfix or-chart: undefined unit text in chart tooltip when dataset.unit is missing (#2038)

Dominique Kleevenec022caef366
diff --git a/ui/component/or-chart/src/index.ts b/ui/component/or-chart/src/index.ts
index d1b376ac0..eb92d48e5 100644
--- a/ui/component/or-chart/src/index.ts
+++ b/ui/component/or-chart/src/index.ts
@@ -1582,7 +1582,7 @@ export class OrChart extends translate(i18next)(LitElement) {
if (displayValue) {
tooltipArray.push({
value: displayValue,
- text: `<div><span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color: ${dataset.lineStyle?.color}"></span> ${name}: <b>${displayValue} ${dataset.unit}</b></div>`
+ text: `<div><span style="display:inline-block;margin-right:5px;border-radius:10px;width:9px;height:9px;background-color: ${dataset.lineStyle?.color}"></span> ${name}: <b>${displayValue}${dataset.unit ?? ""}</b></div>`
});
}
}