zhaobao 1 jaar geleden
bovenliggende
commit
362f903533
2 gewijzigde bestanden met toevoegingen van 13 en 3 verwijderingen
  1. 11 1
      src/views/bigScreen/home/components/WaveChart.vue
  2. 2 2
      src/views/bigScreen/home/index.vue

+ 11 - 1
src/views/bigScreen/home/components/WaveChart.vue

@@ -111,7 +111,17 @@ export default {
     show(params) {
       this.initChart(params)
     },
+    drawChart({ x, y, z }) {
+      this.myChart.clear()
+      this.setChart({ x, y, z })
+    },
     setChart({ x, y, z }) {
+      this.option.series[0].data = x
+      this.option.series[1].data = y
+      this.option.series[2].data = z
+      this.myChart.setOption(this.option)
+    },
+    setChartType1({ x, y, z }) {
       this.option.series[0].data = x.filter((item, index) => index < 200)
       this.option.series[1].data = y.filter((item, index) => index < 200)
       this.option.series[2].data = z.filter((item, index) => index < 200)
@@ -136,7 +146,7 @@ export default {
           index++
         }
         self.myChart.setOption(self.option)
-      }, 1000)
+      }, 30)
     }
   }
 }

+ 2 - 2
src/views/bigScreen/home/index.vue

@@ -135,10 +135,10 @@ export default {
           const z = data.tdWaveValueZ.substr(0, data.tdWaveValueZ.length - 1).split(',').map(item => parseFloat((item / 100).toFixed(2)))
           const params = { x, y, z }
           self.$nextTick(() => {
-            self.$refs[chartName][0].show(params)
+            self.$refs[chartName][0].drawChart(params)
           })
         })
-      }, 1000 * 60 * 30)
+      }, 1000 * 60 * 1)
     },
     mqttResponse(topic, message) {
       if (!message.includes('{')) {