From f9fc8e8c6672db71661e34874205530d3ef50e48 Mon Sep 17 00:00:00 2001 From: "DESKTOP-FUDKNA8\\znjsz" Date: Wed, 13 Mar 2024 16:08:09 +0800 Subject: [PATCH] 1 --- src/components/HourChart.vue | 8 ++------ src/components/datapage/HourChart.vue | 4 ++-- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/components/HourChart.vue b/src/components/HourChart.vue index 247e994..f07caec 100644 --- a/src/components/HourChart.vue +++ b/src/components/HourChart.vue @@ -17,17 +17,14 @@ const hourData = ref([ // { lineName: "005", hour: "00:50", num: 50 }, ]); store.$subscribe((mutation, state) => { - // console.log("[HourChart] =======>", state.data2.lineHourList?.length); if ( state.data2.lineHourList == undefined || state.data2.lineHourList?.length == 0 ) { - // console.log("[HourChart] 清除数据"); hourData.value.splice(0); if (chart.value) chart.value.dispose(); return; } - // console.log("[HourChart] ===> 有数据: ", state.data2.lineHourList); hourData.value = (state.data2?.lineHourList ?? [ // { lineName: '001', hour: '00:00', num: 10 }, // { lineName: '002', hour: '00:20', num: 20 }, @@ -36,8 +33,8 @@ store.$subscribe((mutation, state) => { // { lineName: '005', hour: '00:50', num: 50 }, ]).map((item, index) => ({ id: `${item.lineName}_${index}`, - hour: item.hour || `${index}`.padStart(2, "0"), - data: item.num || Math.floor(Math.random() * 100), + hour: item.hour || '__', + data: item.num || 0, })); setupChart(); }); @@ -46,7 +43,6 @@ function setupChart() { if (chart.value) chart.value.dispose(); nextTick(() => { chart.value = echarts.init(chartChart.value); - // console.log("[HourChart] ===> 设置chart: ", chart.value, hourData.value.map((item) => item.hour), hourData.value.map((item) => item.data)); chartSetup( chart.value, hourData.value.map((item) => item.hour), diff --git a/src/components/datapage/HourChart.vue b/src/components/datapage/HourChart.vue index 4928dca..78c2d24 100644 --- a/src/components/datapage/HourChart.vue +++ b/src/components/datapage/HourChart.vue @@ -30,8 +30,8 @@ store.$subscribe((mutation, state) => { } hourData.value = (state.data2?.lineHourList ?? []).map((item, index) => ({ id: `${item.lineName}_${index}`, - hour: item.hour || `${index}`.padStart(2, "0"), - data: item.num || Math.floor(Math.random() * 100), + hour: item.hour || `__`, + data: item.num || 0, })); setupChart(); });