From 9aef19c9cf990895fc1fedd1e4600760b52ddbd0 Mon Sep 17 00:00:00 2001 From: "xinxin.wu" Date: Tue, 19 Nov 2024 10:54:00 +0800 Subject: [PATCH] =?UTF-8?q?fix(=E5=B7=A5=E4=BD=9C=E5=8F=B0):=20=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=E5=B7=A5=E4=BD=9C=E5=8F=B0=E6=88=90=E5=91=98=E6=A6=82?= =?UTF-8?q?=E8=A7=88=E6=9F=B1=E7=8A=B6=E5=9B=BEbug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homePage/components/overview.vue | 1 + .../homePage/components/overviewMember.vue | 37 +++++++++++++++---- .../src/views/workbench/homePage/utils.ts | 7 ++-- 3 files changed, 33 insertions(+), 12 deletions(-) diff --git a/frontend/src/views/workbench/homePage/components/overview.vue b/frontend/src/views/workbench/homePage/components/overview.vue index e333557c78..226b07cfaf 100644 --- a/frontend/src/views/workbench/homePage/components/overview.vue +++ b/frontend/src/views/workbench/homePage/components/overview.vue @@ -123,6 +123,7 @@ return { name: item.name, value: e, + originValue: e, tooltip: { show: true, trigger: 'item', diff --git a/frontend/src/views/workbench/homePage/components/overviewMember.vue b/frontend/src/views/workbench/homePage/components/overviewMember.vue index d576e7f79f..ee6e43fb03 100644 --- a/frontend/src/views/workbench/homePage/components/overviewMember.vue +++ b/frontend/src/views/workbench/homePage/components/overviewMember.vue @@ -98,23 +98,44 @@ options.value.graphic.invisible = invisible; options.value.graphic.style.text = text; options.value.xAxis.data = detail.xaxis.map((e) => characterLimit(e, 10)); - let maxAxis = 5; - options.value.series = detail.projectCountList.map((item, index) => { - const itemMax = Math.max(...item.count); - maxAxis = Math.max(itemMax, maxAxis); + const rawData: number[][] = []; + + detail.projectCountList.forEach((item: any) => { + rawData.push(item.count); + }); + + const totalData: number[] = []; + + for (let i = 0; i < rawData[0].length; ++i) { + let sum = 0; + for (let j = 0; j < rawData.length; ++j) { + sum += rawData[j][i]; + } + totalData.push(sum); + } + + options.value.series = detail.projectCountList.map((item, sid) => { + const dataList = rawData[sid].map((d, did) => (totalData[did] <= 0 ? 0 : d / totalData[did])); + + const data = dataList.map((e, i) => { + return { + name: t(contentTabList[sid].label), + value: e, + originValue: item.count[i], + }; + }); return { - name: t(contentTabList[index].label), + name: t(contentTabList[sid].label), type: 'bar', - stack: 'member', + stack: 'total', barWidth: 12, - data: item.count, itemStyle: { borderRadius: [2, 2, 0, 0], }, + data, }; }); - options.value.yAxis[0].max = maxAxis < 100 ? 50 : maxAxis + 50; } async function initOverViewMemberDetail() { diff --git a/frontend/src/views/workbench/homePage/utils.ts b/frontend/src/views/workbench/homePage/utils.ts index 7d909a9df1..cd9de7da49 100644 --- a/frontend/src/views/workbench/homePage/utils.ts +++ b/frontend/src/views/workbench/homePage/utils.ts @@ -84,7 +84,7 @@ export function getCommonBarOptions(hasRoom: boolean, color: string[]): Record
${item.seriesName}
-
${addCommasToNumber(item.value || 0)}
+
${addCommasToNumber(item.data.originValue || 0)}
` ) @@ -124,9 +124,8 @@ export function getCommonBarOptions(hasRoom: boolean, color: string[]): Record