Browse Source

折线图

master
sige 1 year ago
parent
commit
5e10f9d214
  1. 16
      src/components/Progress.vue
  2. 14
      src/store/modules/echarts.js
  3. 8
      src/store/modules/websocket.js

16
src/components/Progress.vue

@ -662,25 +662,25 @@ onMounted(() => {
name: '温度', name: '温度',
type: 'line', type: 'line',
stack: '1', stack: '1',
data: [],
data: echartsStore.envir1Temp,
}, },
{ {
name: '湿度', name: '湿度',
type: 'line', type: 'line',
stack: '2', stack: '2',
data: [],
data: echartsStore.envir1Humidity,
}, },
{ {
name: 'H2O2浓度', name: 'H2O2浓度',
type: 'line', type: 'line',
stack: '3', stack: '3',
data: [],
data: echartsStore.envir1HP,
}, },
{ {
name: 'H2O2饱和度', name: 'H2O2饱和度',
type: 'line', type: 'line',
stack: '4', stack: '4',
data: [],
data: echartsStore.envir1Saturation,
}, },
], ],
}) })
@ -710,25 +710,25 @@ onMounted(() => {
name: '温度', name: '温度',
type: 'line', type: 'line',
stack: '1', stack: '1',
data: [],
data: echartsStore.envir2Temp,
}, },
{ {
name: '湿度', name: '湿度',
type: 'line', type: 'line',
stack: '2', stack: '2',
data: [],
data: echartsStore.envir2Humidity,
}, },
{ {
name: 'H2O2浓度', name: 'H2O2浓度',
type: 'line', type: 'line',
stack: '3', stack: '3',
data: [],
data: echartsStore.envir2HP,
}, },
{ {
name: 'H2O2饱和度', name: 'H2O2饱和度',
type: 'line', type: 'line',
stack: '4', stack: '4',
data: [],
data: echartsStore.envir2Saturation,
}, },
], ],
}) })

14
src/store/modules/echarts.js

@ -78,6 +78,13 @@ export const useEchartsStore = defineStore({
}) })
return arr return arr
}, },
envir1Saturation(state) {
let arr = []
Object.values(state.envir1Charts).map(item => {
arr.push(item[3])
})
return arr
},
envir2Temp(state) { envir2Temp(state) {
let arr = [] let arr = []
Object.values(state.envir2Charts).map(item => { Object.values(state.envir2Charts).map(item => {
@ -99,5 +106,12 @@ export const useEchartsStore = defineStore({
}) })
return arr return arr
}, },
envir2Saturation(state) {
let arr = []
Object.values(state.envir2Charts).map(item => {
arr.push(item[3])
})
return arr
},
}, },
}) })

8
src/store/modules/websocket.js

@ -149,8 +149,8 @@ export const useWebSocketStore = defineStore({
saveEchartsDataToLocal( saveEchartsDataToLocal(
moment().utcOffset(8).format('HH:mm'), moment().utcOffset(8).format('HH:mm'),
[temp_1, humid_1, h2o2_1, saturation_1], [temp_1, humid_1, h2o2_1, saturation_1],
[temp_2, humid_2, h2o2_2, saturation_1],
[temp_3, humid_3, h2o2_3, saturation_1],
[temp_2, humid_2, h2o2_2, saturation_2],
[temp_3, humid_3, h2o2_3, saturation_3],
) )
echartsStore.updateBinCharts( echartsStore.updateBinCharts(
JSON.parse(localStorage.getItem('bin')), JSON.parse(localStorage.getItem('bin')),
@ -340,8 +340,8 @@ export const useWebSocketStore = defineStore({
saveEchartsDataToLocal( saveEchartsDataToLocal(
moment().utcOffset(8).format('HH:mm'), moment().utcOffset(8).format('HH:mm'),
[temp_1, humid_1, h2o2_1, saturation_1], [temp_1, humid_1, h2o2_1, saturation_1],
[temp_2, humid_2, h2o2_2, saturation_1],
[temp_3, humid_3, h2o2_3, saturation_1],
[temp_2, humid_2, h2o2_2, saturation_2],
[temp_3, humid_3, h2o2_3, saturation_3],
) )
echartsStore.updateBinCharts( echartsStore.updateBinCharts(
JSON.parse(localStorage.getItem('bin')), JSON.parse(localStorage.getItem('bin')),

Loading…
Cancel
Save