forked from Gitlink/forgeplus-react
成果库概览图优化
This commit is contained in:
parent
ff81c1523d
commit
aed4df4479
|
|
@ -21,16 +21,25 @@ function AchivChart() {
|
||||||
|
|
||||||
// 转换函数
|
// 转换函数
|
||||||
function preprocessData(data) {
|
function preprocessData(data) {
|
||||||
return data.map(function(item) {
|
let hasNonZeroValue = false;
|
||||||
if (item.value === 0) {
|
|
||||||
return {
|
for (let i = 0; i < data.length; i++) {
|
||||||
value: null,
|
if (data[i].value !== 0) {
|
||||||
name: item.name
|
hasNonZeroValue = true;
|
||||||
};
|
break;
|
||||||
} else {
|
|
||||||
return item;
|
|
||||||
}
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
|
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
|
// echarts data
|
||||||
|
|
@ -42,6 +51,14 @@ function AchivChart() {
|
||||||
{ value: achivData.equipAchievement, name: '装备成果 ' + achivData.equipAchievement + '%' },
|
{ value: achivData.equipAchievement, name: '装备成果 ' + achivData.equipAchievement + '%' },
|
||||||
{ value: achivData.anotherCount, name: '其他成果 ' + achivData.anotherCount + '%' }
|
{ 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从大到小排序
|
// 按照value从大到小排序
|
||||||
let sortedData = data.sort((a, b) => { return b.value - a.value } );
|
let sortedData = data.sort((a, b) => { return b.value - a.value } );
|
||||||
|
|
@ -57,7 +74,7 @@ function AchivChart() {
|
||||||
title: {
|
title: {
|
||||||
text: '成果数量占比统计',
|
text: '成果数量占比统计',
|
||||||
left: 215,
|
left: 215,
|
||||||
top: 380,
|
top: 385,
|
||||||
textStyle: {
|
textStyle: {
|
||||||
fontSize: 18
|
fontSize: 18
|
||||||
}
|
}
|
||||||
|
|
@ -65,7 +82,7 @@ function AchivChart() {
|
||||||
legend: {
|
legend: {
|
||||||
orient: 'vertical',
|
orient: 'vertical',
|
||||||
right: 10,
|
right: 10,
|
||||||
top: 105,
|
top: 108,
|
||||||
itemGap: 16,
|
itemGap: 16,
|
||||||
itemWidth: 32,
|
itemWidth: 32,
|
||||||
itemHeight: 24,
|
itemHeight: 24,
|
||||||
|
|
@ -86,7 +103,7 @@ function AchivChart() {
|
||||||
name: 'Nightingale Chart',
|
name: 'Nightingale Chart',
|
||||||
type: 'pie',
|
type: 'pie',
|
||||||
radius: [35, 145],
|
radius: [35, 145],
|
||||||
center: ['150', '50%'],
|
center: ['160', '50%'],
|
||||||
roseType: 'area',
|
roseType: 'area',
|
||||||
clockwise: false,
|
clockwise: false,
|
||||||
startAngle: 45,
|
startAngle: 45,
|
||||||
|
|
@ -107,10 +124,10 @@ function AchivChart() {
|
||||||
],
|
],
|
||||||
graphic: {
|
graphic: {
|
||||||
type: 'text',
|
type: 'text',
|
||||||
left: '133',
|
left: '142',
|
||||||
top: 'middle',
|
top: 'middle',
|
||||||
style: {
|
style: {
|
||||||
text: '成果\n类型',
|
text: '成果\n来源',
|
||||||
fill: '#333',
|
fill: '#333',
|
||||||
fontSize: 18,
|
fontSize: 18,
|
||||||
fontWeight: 'bold',
|
fontWeight: 'bold',
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@
|
||||||
box-shadow:0px 6px 18px rgba(171, 202, 255, 0.24) inset;
|
box-shadow:0px 6px 18px rgba(171, 202, 255, 0.24) inset;
|
||||||
|
|
||||||
#leftBox {
|
#leftBox {
|
||||||
width: 515px;
|
width: 495px;
|
||||||
height: 450px;
|
height: 450px;
|
||||||
position: relative;
|
position: relative;
|
||||||
.count-top {
|
.count-top {
|
||||||
|
|
@ -16,7 +16,7 @@
|
||||||
width: 190px;
|
width: 190px;
|
||||||
height: 95px;
|
height: 95px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 87px;
|
top: 110px;
|
||||||
right: 130px;
|
right: 130px;
|
||||||
background:#f7faff;
|
background:#f7faff;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
@ -66,7 +66,7 @@
|
||||||
width: 190px;
|
width: 190px;
|
||||||
height: 95px;
|
height: 95px;
|
||||||
position: absolute;
|
position: absolute;
|
||||||
top: 227px;
|
top: 250px;
|
||||||
right: 130px;
|
right: 130px;
|
||||||
background:#f7faff;
|
background:#f7faff;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|
@ -113,11 +113,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#chartBox {
|
#chartBox {
|
||||||
width: 500px;
|
width: 515px;
|
||||||
height: 450px;
|
height: 450px;
|
||||||
}
|
}
|
||||||
#blankBox {
|
#blankBox {
|
||||||
width: 185px;
|
width: 190px;
|
||||||
height: 450px;
|
height: 450px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -576,6 +576,7 @@ class NewHeader extends Component {
|
||||||
}
|
}
|
||||||
|
|
||||||
matchpaths = (url) => {
|
matchpaths = (url) => {
|
||||||
|
console.log('@@@进入 newhead > matchpaths');
|
||||||
const { match } = this.props;
|
const { match } = this.props;
|
||||||
const hostname = window.location.hostname;
|
const hostname = window.location.hostname;
|
||||||
const port = window.location.port;
|
const port = window.location.port;
|
||||||
|
|
@ -596,8 +597,14 @@ class NewHeader extends Component {
|
||||||
|
|
||||||
// console.log(str, (url + "/"), url && str === url);
|
// console.log(str, (url + "/"), url && str === url);
|
||||||
if (url && (str === url || str === (url + "/"))) {
|
if (url && (str === url || str === (url + "/"))) {
|
||||||
|
console.log('@@@ matchpaths true');
|
||||||
|
console.log('url:',url);
|
||||||
|
console.log('str:',str);
|
||||||
return true
|
return true
|
||||||
} else {
|
} else {
|
||||||
|
console.log('@@@ matchpaths true');
|
||||||
|
console.log('url:',url);
|
||||||
|
console.log('str:',str);
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue