From eeafb50f618d938fb946f42c4ea5b066e58311ba Mon Sep 17 00:00:00 2001 From: Hubert Nusser Date: Thu, 25 Mar 2021 21:54:33 +0100 Subject: [PATCH] Replace double percent sign in chart unit, fixes #870, fixes #928 Signed-off-by: Hubert Nusser --- bundles/org.openhab.ui/web/src/pages/analyzer/analyzer.vue | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bundles/org.openhab.ui/web/src/pages/analyzer/analyzer.vue b/bundles/org.openhab.ui/web/src/pages/analyzer/analyzer.vue index fa1da7c614..884545097b 100644 --- a/bundles/org.openhab.ui/web/src/pages/analyzer/analyzer.vue +++ b/bundles/org.openhab.ui/web/src/pages/analyzer/analyzer.vue @@ -317,13 +317,14 @@ export default { // dynamically add value axes according to unit if determined const seriesOptions = this.seriesOptions[item.name] if (!seriesOptions.discrete && (seriesOptions.type === 'line' || seriesOptions.type === 'bar')) { - const unit = (item.transformedState && item.transformedState.split(' ').length === 2) + let unit = (item.transformedState && item.transformedState.split(' ').length === 2) ? item.transformedState.split(' ')[1] : (item.state.split(' ').length === 2) ? item.state.split(' ')[1] : (item.stateDescription && item.stateDescription.pattern && item.stateDescription.pattern.split(' ').length === 2) ? item.stateDescription.pattern.split(' ')[1] : undefined + if (unit) unit = unit.replace(/^%%/, '%') let unitAxis = this.valueAxesOptions.findIndex((a) => a.unit === unit) if (unitAxis >= 0) { this.$set(seriesOptions, 'valueAxisIndex', unitAxis)