графики расхода

This commit is contained in:
Dmitry Borisenko
2022-09-28 17:26:33 +02:00
parent 84dfcd10d3
commit b3b4cbeb10
5 changed files with 20 additions and 12 deletions

View File

@@ -12,7 +12,7 @@
function blink() {
if (widget.status) {
if (widget.status != prevStatus) {
setTimeout(stopBlink, 4000);
setTimeout(stopBlink, 500);
green = true;
}
prevStatus = widget.status;
@@ -31,8 +31,8 @@
</div>
<div class="flex justify-end w-1/3">
<!-- svelte-ignore a11y-label-has-associated-control -->
<label class="wgt-adt-stl {green ? 'text-green-500 animate-pulse' : ''}">{!widget.status ? "" : widget.status}</label>
<label class="wgt-adt-stl {green ? 'text-green-500' : ''}">{!widget.status ? "" : widget.status}</label>
<!-- svelte-ignore a11y-label-has-associated-control -->
<label class="wgt-adt-stl {green ? 'text-green-500 animate-pulse' : ''}">&nbsp;{!widget.after ? "" : widget.after}</label>
<label class="wgt-adt-stl {green ? 'text-green-500' : ''}">&nbsp;{!widget.after ? "" : widget.after}</label>
</div>
</div>

View File

@@ -33,6 +33,11 @@
lineOptions = { regionFill: 1, dotSize: 3, spline: 1 };
}
let type = "line";
if (widget.type == "bar") {
type = widget.type;
}
$: widget, collectDataToArr();
function collectDataToArr() {
@@ -49,7 +54,9 @@
}
for (let i = 0; i < widget.status.length; i++) {
if (i === 0) {
if (type === "bar") {
labels[i] = getDDMM(widget.status[i].x);
} else if (i === 0) {
labels[i] = getDDMM(widget.status[i].x);
} else {
labels[i] = getHHMM(widget.status[i].x);
@@ -107,4 +114,4 @@
<label class="inline-block italic align-top text-center text-gray-500 txt-sz">{!widget.descr ? "" : widget.descr}</label>
</div>
<Chart data={datachart} type="line" lineOptions={lineOptions} axisOptions={axisOptions} height="200" padding="0px" />
<Chart data={datachart} type={type} lineOptions={lineOptions} axisOptions={axisOptions} height="200" padding="0px" />