forked from Gitlink/forgeplus-react
成果库概览图优化
This commit is contained in:
parent
ff81c1523d
commit
aed4df4479
|
|
@ -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) {
|
||||
// 如果所有value都为0,则不做任何改变
|
||||
return data;
|
||||
} else {
|
||||
// 部分value为0,则将0变为null
|
||||
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',
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue