成果库概览图优化

This commit is contained in:
zhangxzz 2023-11-22 16:41:58 +08:00
parent ff81c1523d
commit aed4df4479
3 changed files with 43 additions and 19 deletions

View File

@ -21,16 +21,25 @@ function AchivChart() {
//
function preprocessData(data) {
return data.map(function(item) {
if (item.value === 0) {
return {
value: null,
name: item.name
};
} else {
return item;
let hasNonZeroValue = false;
for (let i = 0; i < data.length; i++) {
if (data[i].value !== 0) {
hasNonZeroValue = true;
break;
}
});
}
if (!hasNonZeroValue) {
// value0
return data;
} else {
// value00null
return data.map(item => ({
...item,
value: item.value === 0 ? null : item.value
}));
}
}
// echarts data
@ -42,6 +51,14 @@ function AchivChart() {
{ value: achivData.equipAchievement, name: '装备成果 ' + achivData.equipAchievement + '%' },
{ value: achivData.anotherCount, name: '其他成果 ' + achivData.anotherCount + '%' }
];
// let data = [
// { value: 0, name: ' ' + achivData.osProjectCount + '%' },
// { value: 0, name: ' ' + achivData.ckTaskCount + '%' },
// { value: 0, name: ' ' + achivData.osContestCount + '%' },
// { value: 0, name: ' ' + achivData.scienceAchievementCount + '%' },
// { value: 0, name: ' ' + achivData.equipAchievement + '%' },
// { value: 0, name: ' ' + achivData.anotherCount + '%' }
// ];
// value
let sortedData = data.sort((a, b) => { return b.value - a.value } );
@ -57,7 +74,7 @@ function AchivChart() {
title: {
text: '成果数量占比统计',
left: 215,
top: 380,
top: 385,
textStyle: {
fontSize: 18
}
@ -65,7 +82,7 @@ function AchivChart() {
legend: {
orient: 'vertical',
right: 10,
top: 105,
top: 108,
itemGap: 16,
itemWidth: 32,
itemHeight: 24,
@ -86,7 +103,7 @@ function AchivChart() {
name: 'Nightingale Chart',
type: 'pie',
radius: [35, 145],
center: ['150', '50%'],
center: ['160', '50%'],
roseType: 'area',
clockwise: false,
startAngle: 45,
@ -107,10 +124,10 @@ function AchivChart() {
],
graphic: {
type: 'text',
left: '133',
left: '142',
top: 'middle',
style: {
text: '成果\n类型',
text: '成果\n来源',
fill: '#333',
fontSize: 18,
fontWeight: 'bold',

View File

@ -8,7 +8,7 @@
box-shadow:0px 6px 18px rgba(171, 202, 255, 0.24) inset;
#leftBox {
width: 515px;
width: 495px;
height: 450px;
position: relative;
.count-top {
@ -16,7 +16,7 @@
width: 190px;
height: 95px;
position: absolute;
top: 87px;
top: 110px;
right: 130px;
background:#f7faff;
box-sizing: border-box;
@ -66,7 +66,7 @@
width: 190px;
height: 95px;
position: absolute;
top: 227px;
top: 250px;
right: 130px;
background:#f7faff;
box-sizing: border-box;
@ -113,11 +113,11 @@
}
}
#chartBox {
width: 500px;
width: 515px;
height: 450px;
}
#blankBox {
width: 185px;
width: 190px;
height: 450px;
}
}

View File

@ -576,6 +576,7 @@ class NewHeader extends Component {
}
matchpaths = (url) => {
console.log('@@@进入 newhead > matchpaths');
const { match } = this.props;
const hostname = window.location.hostname;
const port = window.location.port;
@ -596,8 +597,14 @@ class NewHeader extends Component {
// console.log(str, (url + "/"), url && str === url);
if (url && (str === url || str === (url + "/"))) {
console.log('@@@ matchpaths true');
console.log('url:',url);
console.log('str:',str);
return true
} else {
console.log('@@@ matchpaths true');
console.log('url:',url);
console.log('str:',str);
return false
}