DmitrMakeev commited on
Commit
2600717
·
verified ·
1 Parent(s): bbcfda3

Update online.html

Browse files
Files changed (1) hide show
  1. online.html +29 -33
online.html CHANGED
@@ -649,41 +649,37 @@ document.getElementById("but_sliv").addEventListener("click", function() {
649
  }
650
 
651
  function updateDataHistory(data) {
652
- // Добавляем новые значения в конец
653
- dataHistory.labels.push(dataHistory.labels.length);
654
- dataHistory.dates.push(data.date);
655
- dataHistory.times.push(data.time);
656
- dataHistory.ph.push(parseFloat(data.ph) || 0);
657
- dataHistory.ec.push(parseFloat(data.ec) || 0);
658
- dataHistory.ec_A_eep.push(parseFloat(data.ec_A_eep) || 0);
659
- dataHistory.ec_B_eep.push(parseFloat(data.ec_B_eep) || 0);
660
- // Для ec_C_eep заменяем "l" на 1
661
- dataHistory.ec_C_eep.push(data.ec_C_eep === "l" ? 1 : (parseFloat(data.ec_C_eep) || 0));
662
- dataHistory.tS.push(parseFloat(data.tS) || 0);
663
- dataHistory.tA.push(parseFloat(data.tA) || 0);
664
- dataHistory.hDm.push(parseFloat(data.hDm) || 0);
665
- dataHistory.sVen.push(parseFloat(data.sVen) || 0);
666
-
667
- // Обрезаем до maxPoints, удаляя старые значения с начала
668
- while (dataHistory.labels.length > maxPoints) {
669
- dataHistory.labels.shift();
670
- dataHistory.dates.shift();
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();
680
- dataHistory.sVen.shift();
681
- }
682
-
683
- // Пересчитываем labels как индексы от 0 до maxPoints-1
684
- dataHistory.labels = Array.from({ length: dataHistory.labels.length }, (_, i) => i);
685
  }
686
 
 
 
 
687
  function updateChart() {
688
  const customdata = dataHistory.dates.map((date, i) => [date, dataHistory.times[i]]);
689
  Plotly.update("parametersChart", {
 
649
  }
650
 
651
  function updateDataHistory(data) {
652
+ dataHistory.labels.push(dataHistory.labels.length);
653
+ dataHistory.dates.push(data.date);
654
+ dataHistory.times.push(data.time);
655
+ dataHistory.ph.push(parseFloat(data.ph));
656
+ dataHistory.ec.push(parseFloat(data.ec));
657
+ dataHistory.ec_A_eep.push(parseFloat(data.ec_A_eep));
658
+ dataHistory.ec_B_eep.push(parseFloat(data.ec_B_eep));
659
+ dataHistory.ec_C_eep.push(parseFloat(data.ec_C_eep)); // Без || 0
660
+ dataHistory.tS.push(parseFloat(data.tS));
661
+ dataHistory.tA.push(parseFloat(data.tA));
662
+ dataHistory.hDm.push(parseFloat(data.hDm));
663
+ dataHistory.sVen.push(parseFloat(data.sVen));
664
+
665
+ while (dataHistory.labels.length > maxPoints) {
666
+ dataHistory.labels.shift();
667
+ dataHistory.dates.shift();
668
+ dataHistory.times.shift();
669
+ dataHistory.ph.shift();
670
+ dataHistory.ec.shift();
671
+ dataHistory.ec_A_eep.shift();
672
+ dataHistory.ec_B_eep.shift();
673
+ dataHistory.ec_C_eep.shift();
674
+ dataHistory.tS.shift();
675
+ dataHistory.tA.shift();
676
+ dataHistory.hDm.shift();
677
+ dataHistory.sVen.shift();
 
 
 
 
 
 
 
678
  }
679
 
680
+ dataHistory.labels = Array.from({ length: dataHistory.labels.length }, (_, i) => i);
681
+ }
682
+
683
  function updateChart() {
684
  const customdata = dataHistory.dates.map((date, i) => [date, dataHistory.times[i]]);
685
  Plotly.update("parametersChart", {