fix(工作台): 修复工作台成员概览柱状图bug
This commit is contained in:
parent
f55e108ad2
commit
9aef19c9cf
|
@ -123,6 +123,7 @@
|
|||
return {
|
||||
name: item.name,
|
||||
value: e,
|
||||
originValue: e,
|
||||
tooltip: {
|
||||
show: true,
|
||||
trigger: 'item',
|
||||
|
|
|
@ -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[index].label),
|
||||
name: t(contentTabList[sid].label),
|
||||
value: e,
|
||||
originValue: item.count[i],
|
||||
};
|
||||
});
|
||||
return {
|
||||
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() {
|
||||
|
|
|
@ -84,7 +84,7 @@ export function getCommonBarOptions(hasRoom: boolean, color: string[]): Record<s
|
|||
<div class="mb-[2px] mr-[8px] h-[8px] w-[8px] rounded-sm" style="background:${item.color}"></div>
|
||||
<div class="one-line-text max-w-[100px]" style="color:#959598">${item.seriesName}</div>
|
||||
</div>
|
||||
<div class="text-[#323233] font-medium">${addCommasToNumber(item.value || 0)}</div>
|
||||
<div class="text-[#323233] font-medium">${addCommasToNumber(item.data.originValue || 0)}</div>
|
||||
</div>
|
||||
`
|
||||
)
|
||||
|
@ -124,9 +124,8 @@ export function getCommonBarOptions(hasRoom: boolean, color: string[]): Record<s
|
|||
},
|
||||
yAxis: [
|
||||
{
|
||||
type: 'log',
|
||||
type: 'value',
|
||||
alignTicks: true,
|
||||
logBase: 250,
|
||||
name: t('workbench.homePage.unit'), // 设置单位
|
||||
position: 'left',
|
||||
axisLine: {
|
||||
|
@ -148,7 +147,7 @@ export function getCommonBarOptions(hasRoom: boolean, color: string[]): Record<s
|
|||
type: 'dashed', // 水平线线型,可选 'solid'、'dashed'、'dotted'
|
||||
},
|
||||
},
|
||||
min: 1,
|
||||
min: 0,
|
||||
max: 0,
|
||||
},
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue