From 6c5c4429282d4f4eff133f69d2168a8dd0319e58 Mon Sep 17 00:00:00 2001 From: wx <645899409@qq.com> Date: Tue, 30 Jun 2026 16:39:25 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=81=A5=E5=BA=B7=E6=A3=80=E6=B5=8B-?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=95=B0=E6=8D=AE):=20=E7=9D=A1=E7=9C=A0?= =?UTF-8?q?=E6=8A=98=E7=BA=BF=E5=9B=BE=E6=8C=89=E9=98=B6=E6=AE=B5=E5=88=86?= =?UTF-8?q?=E6=AE=B5=E6=98=BE=E7=A4=BA=EF=BC=8C=E5=90=84=E6=AE=B5=E9=97=B4?= =?UTF-8?q?=E4=B8=8D=E5=86=8D=E8=BF=9E=E7=BB=AD=E8=BF=9E=E7=BA=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 每段睡眠数据(深睡/浅睡/清醒/零星小睡)之间插入 null 断点, ECharts 折线图在 null 处自动断开,使不同睡眠阶段呈现为独立线段。 --- .../monitorToll/userInfo/componets/sleep.vue | 20 +++++++++---------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/src/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/sleep.vue b/src/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/sleep.vue index ea41767..95e0e97 100644 --- a/src/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/sleep.vue +++ b/src/views/healthMonitor/healMonitorManage/monitorToll/userInfo/componets/sleep.vue @@ -168,32 +168,30 @@ let xArr: any[] = []; let yArr: any[] = []; res.timePeriods && - res.timePeriods.map((item) => { + res.timePeriods.forEach((item) => { switch (item.flag) { case 1: // 浅睡 - yArr.push(1); - yArr.push(1); + yArr.push(1, 1, null); break; case 3: // 深睡 - yArr.push(0); - yArr.push(0); + yArr.push(0, 0, null); break; case 4: // 清醒 - yArr.push(3); - yArr.push(3); + yArr.push(3, 3, null); break; case 5: // 零星小睡 - yArr.push(2); - yArr.push(2); + yArr.push(2, 2, null); break; } - xArr.push(dayjs(item.start).format('HH:mm')); - xArr.push(dayjs(item.end).format('HH:mm')); + xArr.push(dayjs(item.start).format('HH:mm'), dayjs(item.end).format('HH:mm'), ''); }); + // 去掉最后多余的 null + if (yArr.length > 0) yArr.pop(); + if (xArr.length > 0) xArr.pop(); const option = { xAxis: { type: 'category',