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

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

@@ -4,12 +4,12 @@
<meta charset="utf-8" /> <meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" /> <meta name="viewport" content="width=device-width,initial-scale=1" />
<title>IoT Manager 4.3.4</title> <title>IoT Manager 4.3.5</title>
<link rel="icon" type="image/png" href="/favicon.ico" /> <link rel="icon" type="image/png" href="/favicon.ico" />
<link rel="stylesheet" href="/build/bundle.css?434" /> <link rel="stylesheet" href="/build/bundle.css?435" />
<script defer src="/build/bundle.js?434"></script> <script defer src="/build/bundle.js?435"></script>
</head> </head>
<body></body> <body></body>

View File

@@ -42,7 +42,7 @@
//****************************************************variable section**********************************************************/ //****************************************************variable section**********************************************************/
//******************************************************************************************************************************/ //******************************************************************************************************************************/
let myip = document.location.hostname; let myip = document.location.hostname;
if (devMode) myip = "192.168.88.248"; if (devMode) myip = "192.168.88.241";
//Flags //Flags
let firstDevListRequest = true; let firstDevListRequest = true;
@@ -769,7 +769,8 @@
widget.topic = settingsJson.root + "/" + config.id; widget.topic = settingsJson.root + "/" + config.id;
if (setWidget !== "nil") layout.push(widget); if (setWidget !== "nil") layout.push(widget);
if (widget.widget === "chart") { //создаем графики с окнами ввода
if (widget.widget === "chart" && widget.type !== "bar") {
let input = getInput(); let input = getInput();
input.page = config.page; input.page = config.page;
input.topic = settingsJson.root + "/" + config.id + "-date"; input.topic = settingsJson.root + "/" + config.id + "-date";

View File

@@ -16,7 +16,7 @@
export let saveConfig = () => {}; export let saveConfig = () => {};
export let rebootEsp = () => {}; export let rebootEsp = () => {};
export let cleanLogs = () => {}; //export let cleanLogs = () => {};
function elementsDropdownChange() { function elementsDropdownChange() {
for (let i = 0; i < itemsJson.length; i++) { for (let i = 0; i < itemsJson.length; i++) {
@@ -137,7 +137,7 @@
<div class="grd-1col1"> <div class="grd-1col1">
<Card> <Card>
<div class="grd-2col1"> <div class="grd-2col1">
<button class="btn-lg" on:click={() => (cleanLogs(), saveConfig())}>{"Сохранить"}</button> <button class="btn-lg" on:click={() => saveConfig()}>{"Сохранить"}</button>
<button class="btn-lg" on:click={() => rebootEsp()}>{"Перезагрузить"}</button> <button class="btn-lg" on:click={() => rebootEsp()}>{"Перезагрузить"}</button>
</div> </div>
</Card> </Card>

View File

@@ -12,7 +12,7 @@
function blink() { function blink() {
if (widget.status) { if (widget.status) {
if (widget.status != prevStatus) { if (widget.status != prevStatus) {
setTimeout(stopBlink, 4000); setTimeout(stopBlink, 500);
green = true; green = true;
} }
prevStatus = widget.status; prevStatus = widget.status;
@@ -31,8 +31,8 @@
</div> </div>
<div class="flex justify-end w-1/3"> <div class="flex justify-end w-1/3">
<!-- svelte-ignore a11y-label-has-associated-control --> <!-- 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 --> <!-- 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>
</div> </div>

View File

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