From f03420d43d69ee99a0a9534097e38b111abba4f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9Cyu=E2=80=9D?= <“winebunny@163.com”> Date: Wed, 17 Jul 2024 21:31:07 +0800 Subject: [PATCH] yy --- .../pages/OpticalStoragePage/storeLine.vue | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/views/pages/OpticalStoragePage/storeLine.vue b/src/views/pages/OpticalStoragePage/storeLine.vue index ecf21fc..49a0c05 100644 --- a/src/views/pages/OpticalStoragePage/storeLine.vue +++ b/src/views/pages/OpticalStoragePage/storeLine.vue @@ -18,7 +18,6 @@ onMounted(() => { }); const props = defineProps<{ echartArr: any[]; - }>(); // 获取echart挂载的DOM节点 @@ -56,7 +55,14 @@ const drawOneLine = (arr: any) => { function getDom(param: any) { let newStr = ""; param.forEach((item: any) => { - let unit = item.series.unit + let unit="" + if (item.seriesName.indexOf("电压") !== -1) { + unit = " V"; + } else if (item.seriesName.indexOf("电流") !== -1) { + unit = " A"; + } else if (item.seriesName.indexOf("功率") !== -1) { + unit = " kW"; + } newStr += `
${ item.seriesName }:
${ @@ -72,7 +78,7 @@ const drawOneLine = (arr: any) => { top: "0%", right: "5%", orient: "vertical", - data: ["总功率","电压","电流"], + data: ["总功率", "电压", "电流"], itemWidth: transformFontSize(40), itemHeight: transformFontSize(18), itemGap: transformFontSize(8), @@ -83,7 +89,7 @@ const drawOneLine = (arr: any) => { }, grid: { top: "25%", - left: "8%", + left: "18%", right: "8%", bottom: "13%", }, @@ -159,7 +165,6 @@ const drawOneLine = (arr: any) => { }, // data: [20, 42, 41, 24, 40, 30, 10], data: arr.map((yitem) => yitem.p), - unit:'kW' }, { name: "电压", @@ -188,7 +193,6 @@ const drawOneLine = (arr: any) => { }, // data: [20, 42, 41, 24, 40, 30, 10], data: arr.map((yitem) => yitem.u), - unit:'V' }, { name: "电流", @@ -217,7 +221,6 @@ const drawOneLine = (arr: any) => { }, // data: [20, 42, 41, 24, 40, 30, 10], data: arr.map((yitem) => yitem.i), - unit:'A' }, ], }; @@ -234,5 +237,6 @@ const drawOneLine = (arr: any) => { .OneLine { height: 100%; width: 100%; + border: 1px solid red; }