Spaces:
Running
Running
Update online.html
Browse files- online.html +25 -26
online.html
CHANGED
|
@@ -485,9 +485,9 @@ document.getElementById("but_sliv").addEventListener("click", function() {
|
|
| 485 |
times: [],
|
| 486 |
ph: [],
|
| 487 |
ec: [],
|
| 488 |
-
ec_A_eep: [],
|
| 489 |
-
ec_B_eep: [],
|
| 490 |
-
ec_C_eep: [],
|
| 491 |
tS: [],
|
| 492 |
tA: [],
|
| 493 |
hDm: [],
|
|
@@ -539,7 +539,7 @@ document.getElementById("but_sliv").addEventListener("click", function() {
|
|
| 539 |
y: dataHistory.ec_A_eep,
|
| 540 |
name: "Насос A",
|
| 541 |
mode: "lines+markers",
|
| 542 |
-
line: { color: "#00CED1" },
|
| 543 |
marker: { size: 6 },
|
| 544 |
customdata: dataHistory.dates.map((date, i) => [date, dataHistory.times[i]]),
|
| 545 |
hovertemplate: "<b>Насос A: %{y}</b><br>Дата: %{customdata[0]}<br>Время: %{customdata[1]}<extra></extra>",
|
|
@@ -551,7 +551,7 @@ document.getElementById("but_sliv").addEventListener("click", function() {
|
|
| 551 |
y: dataHistory.ec_B_eep,
|
| 552 |
name: "Насос B",
|
| 553 |
mode: "lines+markers",
|
| 554 |
-
line: { color: "#FF1493" },
|
| 555 |
marker: { size: 6 },
|
| 556 |
customdata: dataHistory.dates.map((date, i) => [date, dataHistory.times[i]]),
|
| 557 |
hovertemplate: "<b>Насос B: %{y}</b><br>Дата: %{customdata[0]}<br>Время: %{customdata[1]}<extra></extra>",
|
|
@@ -563,7 +563,7 @@ document.getElementById("but_sliv").addEventListener("click", function() {
|
|
| 563 |
y: dataHistory.ec_C_eep,
|
| 564 |
name: "Насос C",
|
| 565 |
mode: "lines+markers",
|
| 566 |
-
line: { color: "#FFD700" },
|
| 567 |
marker: { size: 6 },
|
| 568 |
customdata: dataHistory.dates.map((date, i) => [date, dataHistory.times[i]]),
|
| 569 |
hovertemplate: "<b>Насос C: %{y}</b><br>Дата: %{customdata[0]}<br>Время: %{customdata[1]}<extra></extra>",
|
|
@@ -655,9 +655,10 @@ document.getElementById("but_sliv").addEventListener("click", function() {
|
|
| 655 |
dataHistory.times.push(data.time);
|
| 656 |
dataHistory.ph.push(parseFloat(data.ph) || 0);
|
| 657 |
dataHistory.ec.push(parseFloat(data.ec) || 0);
|
| 658 |
-
|
| 659 |
-
dataHistory.
|
| 660 |
-
dataHistory.
|
|
|
|
| 661 |
dataHistory.tS.push(parseFloat(data.tS) || 0);
|
| 662 |
dataHistory.tA.push(parseFloat(data.tA) || 0);
|
| 663 |
dataHistory.hDm.push(parseFloat(data.hDm) || 0);
|
|
@@ -670,9 +671,9 @@ document.getElementById("but_sliv").addEventListener("click", function() {
|
|
| 670 |
dataHistory.times.shift();
|
| 671 |
dataHistory.ph.shift();
|
| 672 |
dataHistory.ec.shift();
|
| 673 |
-
dataHistory.ec_A_eep.shift();
|
| 674 |
-
dataHistory.ec_B_eep.shift();
|
| 675 |
-
dataHistory.ec_C_eep.shift();
|
| 676 |
dataHistory.tS.shift();
|
| 677 |
dataHistory.tA.shift();
|
| 678 |
dataHistory.hDm.shift();
|
|
@@ -693,16 +694,16 @@ document.getElementById("but_sliv").addEventListener("click", function() {
|
|
| 693 |
dataHistory.labels,
|
| 694 |
dataHistory.labels,
|
| 695 |
dataHistory.labels,
|
| 696 |
-
dataHistory.labels,
|
| 697 |
-
dataHistory.labels,
|
| 698 |
-
dataHistory.labels
|
| 699 |
],
|
| 700 |
y: [
|
| 701 |
dataHistory.ph,
|
| 702 |
dataHistory.ec,
|
| 703 |
-
dataHistory.ec_A_eep,
|
| 704 |
-
dataHistory.ec_B_eep,
|
| 705 |
-
dataHistory.ec_C_eep,
|
| 706 |
dataHistory.tS,
|
| 707 |
dataHistory.tA,
|
| 708 |
dataHistory.hDm,
|
|
@@ -715,9 +716,9 @@ document.getElementById("but_sliv").addEventListener("click", function() {
|
|
| 715 |
customdata,
|
| 716 |
customdata,
|
| 717 |
customdata,
|
| 718 |
-
customdata,
|
| 719 |
-
customdata,
|
| 720 |
-
customdata
|
| 721 |
]
|
| 722 |
});
|
| 723 |
}
|
|
@@ -738,22 +739,20 @@ document.getElementById("but_sliv").addEventListener("click", function() {
|
|
| 738 |
// Обработчик изменения периода
|
| 739 |
document.getElementById("periodSelect").addEventListener("change", function() {
|
| 740 |
maxPoints = parseInt(this.value);
|
| 741 |
-
// Обрезаем данные до нового лимита
|
| 742 |
while (dataHistory.labels.length > maxPoints) {
|
| 743 |
dataHistory.labels.shift();
|
| 744 |
dataHistory.dates.shift();
|
| 745 |
dataHistory.times.shift();
|
| 746 |
dataHistory.ph.shift();
|
| 747 |
dataHistory.ec.shift();
|
| 748 |
-
dataHistory.ec_A_eep.shift();
|
| 749 |
-
dataHistory.ec_B_eep.shift();
|
| 750 |
-
dataHistory.ec_C_eep.shift();
|
| 751 |
dataHistory.tS.shift();
|
| 752 |
dataHistory.tA.shift();
|
| 753 |
dataHistory.hDm.shift();
|
| 754 |
dataHistory.sVen.shift();
|
| 755 |
}
|
| 756 |
-
// Пересчитываем labels
|
| 757 |
dataHistory.labels = Array.from({ length: dataHistory.labels.length }, (_, i) => i);
|
| 758 |
updateChart();
|
| 759 |
});
|
|
|
|
| 485 |
times: [],
|
| 486 |
ph: [],
|
| 487 |
ec: [],
|
| 488 |
+
ec_A_eep: [],
|
| 489 |
+
ec_B_eep: [],
|
| 490 |
+
ec_C_eep: [],
|
| 491 |
tS: [],
|
| 492 |
tA: [],
|
| 493 |
hDm: [],
|
|
|
|
| 539 |
y: dataHistory.ec_A_eep,
|
| 540 |
name: "Насос A",
|
| 541 |
mode: "lines+markers",
|
| 542 |
+
line: { color: "#00CED1" },
|
| 543 |
marker: { size: 6 },
|
| 544 |
customdata: dataHistory.dates.map((date, i) => [date, dataHistory.times[i]]),
|
| 545 |
hovertemplate: "<b>Насос A: %{y}</b><br>Дата: %{customdata[0]}<br>Время: %{customdata[1]}<extra></extra>",
|
|
|
|
| 551 |
y: dataHistory.ec_B_eep,
|
| 552 |
name: "Насос B",
|
| 553 |
mode: "lines+markers",
|
| 554 |
+
line: { color: "#FF1493" },
|
| 555 |
marker: { size: 6 },
|
| 556 |
customdata: dataHistory.dates.map((date, i) => [date, dataHistory.times[i]]),
|
| 557 |
hovertemplate: "<b>Насос B: %{y}</b><br>Дата: %{customdata[0]}<br>Время: %{customdata[1]}<extra></extra>",
|
|
|
|
| 563 |
y: dataHistory.ec_C_eep,
|
| 564 |
name: "Насос C",
|
| 565 |
mode: "lines+markers",
|
| 566 |
+
line: { color: "#FFD700" },
|
| 567 |
marker: { size: 6 },
|
| 568 |
customdata: dataHistory.dates.map((date, i) => [date, dataHistory.times[i]]),
|
| 569 |
hovertemplate: "<b>Насос C: %{y}</b><br>Дата: %{customdata[0]}<br>Время: %{customdata[1]}<extra></extra>",
|
|
|
|
| 655 |
dataHistory.times.push(data.time);
|
| 656 |
dataHistory.ph.push(parseFloat(data.ph) || 0);
|
| 657 |
dataHistory.ec.push(parseFloat(data.ec) || 0);
|
| 658 |
+
// Для насосов сохраняем предыдущее значение, если новое не число
|
| 659 |
+
dataHistory.ec_A_eep.push(isNaN(parseFloat(data.ec_A_eep)) ? (dataHistory.ec_A_eep.length > 0 ? dataHistory.ec_A_eep[dataHistory.ec_A_eep.length - 1] : 0) : parseFloat(data.ec_A_eep));
|
| 660 |
+
dataHistory.ec_B_eep.push(isNaN(parseFloat(data.ec_B_eep)) ? (dataHistory.ec_B_eep.length > 0 ? dataHistory.ec_B_eep[dataHistory.ec_B_eep.length - 1] : 0) : parseFloat(data.ec_B_eep));
|
| 661 |
+
dataHistory.ec_C_eep.push(isNaN(parseFloat(data.ec_C_eep)) ? (dataHistory.ec_C_eep.length > 0 ? dataHistory.ec_C_eep[dataHistory.ec_C_eep.length - 1] : 0) : parseFloat(data.ec_C_eep));
|
| 662 |
dataHistory.tS.push(parseFloat(data.tS) || 0);
|
| 663 |
dataHistory.tA.push(parseFloat(data.tA) || 0);
|
| 664 |
dataHistory.hDm.push(parseFloat(data.hDm) || 0);
|
|
|
|
| 671 |
dataHistory.times.shift();
|
| 672 |
dataHistory.ph.shift();
|
| 673 |
dataHistory.ec.shift();
|
| 674 |
+
dataHistory.ec_A_eep.shift();
|
| 675 |
+
dataHistory.ec_B_eep.shift();
|
| 676 |
+
dataHistory.ec_C_eep.shift();
|
| 677 |
dataHistory.tS.shift();
|
| 678 |
dataHistory.tA.shift();
|
| 679 |
dataHistory.hDm.shift();
|
|
|
|
| 694 |
dataHistory.labels,
|
| 695 |
dataHistory.labels,
|
| 696 |
dataHistory.labels,
|
| 697 |
+
dataHistory.labels,
|
| 698 |
+
dataHistory.labels,
|
| 699 |
+
dataHistory.labels
|
| 700 |
],
|
| 701 |
y: [
|
| 702 |
dataHistory.ph,
|
| 703 |
dataHistory.ec,
|
| 704 |
+
dataHistory.ec_A_eep,
|
| 705 |
+
dataHistory.ec_B_eep,
|
| 706 |
+
dataHistory.ec_C_eep,
|
| 707 |
dataHistory.tS,
|
| 708 |
dataHistory.tA,
|
| 709 |
dataHistory.hDm,
|
|
|
|
| 716 |
customdata,
|
| 717 |
customdata,
|
| 718 |
customdata,
|
| 719 |
+
customdata,
|
| 720 |
+
customdata,
|
| 721 |
+
customdata
|
| 722 |
]
|
| 723 |
});
|
| 724 |
}
|
|
|
|
| 739 |
// Обработчик изменения периода
|
| 740 |
document.getElementById("periodSelect").addEventListener("change", function() {
|
| 741 |
maxPoints = parseInt(this.value);
|
|
|
|
| 742 |
while (dataHistory.labels.length > maxPoints) {
|
| 743 |
dataHistory.labels.shift();
|
| 744 |
dataHistory.dates.shift();
|
| 745 |
dataHistory.times.shift();
|
| 746 |
dataHistory.ph.shift();
|
| 747 |
dataHistory.ec.shift();
|
| 748 |
+
dataHistory.ec_A_eep.shift();
|
| 749 |
+
dataHistory.ec_B_eep.shift();
|
| 750 |
+
dataHistory.ec_C_eep.shift();
|
| 751 |
dataHistory.tS.shift();
|
| 752 |
dataHistory.tA.shift();
|
| 753 |
dataHistory.hDm.shift();
|
| 754 |
dataHistory.sVen.shift();
|
| 755 |
}
|
|
|
|
| 756 |
dataHistory.labels = Array.from({ length: dataHistory.labels.length }, (_, i) => i);
|
| 757 |
updateChart();
|
| 758 |
});
|