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(); });