Browse Source

电厂大屏 - 天然气瞬时值横坐标改为12小时

wangggziwen 2 năm trước cách đây
mục cha
commit
90603b2fe8
1 tập tin đã thay đổi với 18 bổ sung12 xóa
  1. 18 12
      ui/src/views/monitor/elec/echart/bottom/bottomRightChart2.vue

+ 18 - 12
ui/src/views/monitor/elec/echart/bottom/bottomRightChart2.vue

@@ -40,14 +40,17 @@ export default {
       //   820, 932, 901, 934, 1290, 1330, 1320
       // ];
 
-      const hourArray = [];
-      const gasArray = [];
+      let hourArray = [];
+      let gasArray = [];
       let data = this.latest24HourData;
       for (let i = 0; i < data.length; i++) {
-        if (i % 3 == 0) {
-          hourArray.push(data[i].pullDate.toString().substr(14, 5));
-          gasArray.push(data[i].gasRealTime);
-        }
+        let pullDate = new Date(data[i].pullDate);
+        hourArray.push(pullDate.getHours() + ":00");
+        gasArray.push(data[i].gasRealTime);
+      }
+      if (hourArray.length > 12) {
+        hourArray = hourArray.slice(0, 12);
+        gasArray = gasArray.slice(0, 12);
       }
       hourArray.reverse();
       gasArray.reverse();
@@ -146,14 +149,17 @@ export default {
       // let lineData = [
       //   820, 932, 901, 934, 1290, 1330, 1320
       // ];
-      const hourArray = [];
-      const gasArray = [];
+      let hourArray = [];
+      let gasArray = [];
       let data = this.latest24HourData;
       for (let i = 0; i < data.length; i++) {
-        if (i % 3 == 0) {
-          hourArray.push(data[i].pullDate.toString().substr(14, 5));
-          gasArray.push(data[i].gasRealTime);
-        }
+        let pullDate = new Date(data[i].pullDate);
+        hourArray.push(pullDate.getHours() + ":00");
+        gasArray.push(data[i].gasRealTime);
+      }
+      if (hourArray.length > 12) {
+        hourArray = hourArray.slice(0, 12);
+        gasArray = gasArray.slice(0, 12);
       }
       hourArray.reverse();
       gasArray.reverse();