master
“yu” 2024-07-17 21:31:07 +08:00
parent efb5917cce
commit f03420d43d
1 changed files with 11 additions and 7 deletions

View File

@ -18,7 +18,6 @@ onMounted(() => {
}); });
const props = defineProps<{ const props = defineProps<{
echartArr: any[]; echartArr: any[];
}>(); }>();
// echartDOM // echartDOM
@ -56,7 +55,14 @@ const drawOneLine = (arr: any) => {
function getDom(param: any) { function getDom(param: any) {
let newStr = ""; let newStr = "";
param.forEach((item: any) => { 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 += `<div style="display:flex;"><div>${ newStr += `<div style="display:flex;"><div>${
item.seriesName item.seriesName
}</div><div>${ }</div><div>${
@ -72,7 +78,7 @@ const drawOneLine = (arr: any) => {
top: "0%", top: "0%",
right: "5%", right: "5%",
orient: "vertical", orient: "vertical",
data: ["总功率","电压","电流"], data: ["总功率", "电压", "电流"],
itemWidth: transformFontSize(40), itemWidth: transformFontSize(40),
itemHeight: transformFontSize(18), itemHeight: transformFontSize(18),
itemGap: transformFontSize(8), itemGap: transformFontSize(8),
@ -83,7 +89,7 @@ const drawOneLine = (arr: any) => {
}, },
grid: { grid: {
top: "25%", top: "25%",
left: "8%", left: "18%",
right: "8%", right: "8%",
bottom: "13%", bottom: "13%",
}, },
@ -159,7 +165,6 @@ const drawOneLine = (arr: any) => {
}, },
// data: [20, 42, 41, 24, 40, 30, 10], // data: [20, 42, 41, 24, 40, 30, 10],
data: arr.map((yitem) => yitem.p), data: arr.map((yitem) => yitem.p),
unit:'kW'
}, },
{ {
name: "电压", name: "电压",
@ -188,7 +193,6 @@ const drawOneLine = (arr: any) => {
}, },
// data: [20, 42, 41, 24, 40, 30, 10], // data: [20, 42, 41, 24, 40, 30, 10],
data: arr.map((yitem) => yitem.u), data: arr.map((yitem) => yitem.u),
unit:'V'
}, },
{ {
name: "电流", name: "电流",
@ -217,7 +221,6 @@ const drawOneLine = (arr: any) => {
}, },
// data: [20, 42, 41, 24, 40, 30, 10], // data: [20, 42, 41, 24, 40, 30, 10],
data: arr.map((yitem) => yitem.i), data: arr.map((yitem) => yitem.i),
unit:'A'
}, },
], ],
}; };
@ -234,5 +237,6 @@ const drawOneLine = (arr: any) => {
.OneLine { .OneLine {
height: 100%; height: 100%;
width: 100%; width: 100%;
border: 1px solid red;
} }
</style> </style>