成果库概览图优化

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) { 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) {
// value0
return data;
} else {
// value00null
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',

View File

@ -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;
} }
} }

View File

@ -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
} }