UIGauge: Add header, but the charts are still rather broken

This commit is contained in:
Starbeamrainbowlabs 2022-04-03 02:41:58 +01:00
parent 07260238c0
commit 1d537e9334
Signed by: sbrl
GPG key ID: 1BE5172E637709C2

View file

@ -1,5 +1,6 @@
"use strict"; "use strict";
import Emel from 'emel';
import ApexCharts from 'apexcharts'; import ApexCharts from 'apexcharts';
import AbstractUIItem from './AbstractUIItem.mjs'; import AbstractUIItem from './AbstractUIItem.mjs';
@ -13,6 +14,11 @@ class UIGauge extends AbstractUIItem {
constructor(el, def) { constructor(el, def) {
super(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 = { this.chart_options = {
series: [{ series: [{
name: def.name, name: def.name,
@ -32,7 +38,7 @@ class UIGauge extends AbstractUIItem {
fill: { opacity: 1 }, fill: { opacity: 1 },
} }
this.chart = new ApexCharts(el, this.chart_options); this.chart = new ApexCharts(el.querySelector(".container-gauge"), this.chart_options);
} }
#__update_chart() { #__update_chart() {