From 1d537e9334f73f46cafefa64ab51721c2ccfea5c Mon Sep 17 00:00:00 2001 From: Starbeamrainbowlabs Date: Sun, 3 Apr 2022 02:41:58 +0100 Subject: [PATCH] UIGauge: Add header, but the charts are still rather broken --- src/static/js/ui/UIGauge.mjs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/static/js/ui/UIGauge.mjs b/src/static/js/ui/UIGauge.mjs index 7c5f990..e3d3505 100644 --- a/src/static/js/ui/UIGauge.mjs +++ b/src/static/js/ui/UIGauge.mjs @@ -1,5 +1,6 @@ "use strict"; +import Emel from 'emel'; import ApexCharts from 'apexcharts'; import AbstractUIItem from './AbstractUIItem.mjs'; @@ -13,6 +14,11 @@ class UIGauge extends AbstractUIItem { constructor(el, def) { super(el, def); + this.emel = new Emel().emel; + this.el.replaceChildren(this.emel(`h3{?}+div[class="container-gauge"]`, { + placeholders: [ this.def.name ] + })); + this.chart_options = { series: [{ name: def.name, @@ -32,7 +38,7 @@ class UIGauge extends AbstractUIItem { fill: { opacity: 1 }, } - this.chart = new ApexCharts(el, this.chart_options); + this.chart = new ApexCharts(el.querySelector(".container-gauge"), this.chart_options); } #__update_chart() {