diff --git a/src/components/Ranking/Ranking.vue b/src/components/Ranking/Ranking.vue index 7768d23..6584791 100644 --- a/src/components/Ranking/Ranking.vue +++ b/src/components/Ranking/Ranking.vue @@ -29,36 +29,40 @@ - - - - GitHub官网数据汇总 - - - - - + + + + GitHub官网数据整理 + + + + + - - + - - + + + + @@ -89,6 +93,10 @@ export default { components: {RightTools}, data(){ return{ + // echart图: + manuChart:null, + // Echart图options: + MyOption:{}, // 最后展示数据: showData:[], // 数据表格表头: @@ -169,12 +177,13 @@ export default { initPage(){ var that = this; that.formName=['语言种类','获得星数']; + this.manuChart = this.$echarts.init(this.$refs.EChart); // this.getNumData(2023,false); - // this.getRenderer(); }, FreshPage(type,index){ var that = this; + this.$refs.totalContent.style.display = 'block'; if(index == true) that.selectedValueByYear = 11; // console.log(that.selectedValueByYear); type = type[type.length-1] - 1; @@ -182,7 +191,6 @@ export default { if(type == 1){ // 按星数统计: this.getNumData(year,that.value1); - this.getRenderer(); that.formName=['语言种类','获得星数'] }else if(type == 2){ @@ -219,42 +227,67 @@ export default { } that.showData = tmp.slice(0,18); that.showData = that.showData.sort(compare('count')); + this.getRenderer(); // console.log(that.showData); }else{ - let quarterItems = [[],[],[],[]]; - //按月度统计:存在两种特例: - // if(year == 2012){ - // quarterItems = [[],[],[]]; - // }else if(year == 2023){ - // quarterItems = {'1':[]}; - // }else{ - // quarterItems = {'1':[],'2':[],'3':[],'4':[]}; - // } - for(let i=0;iitem['name'] == tmpObj['name']); - if (findSignal != -1){ - tmp[findSignal]['count'] = parseInt(tmp[findSignal]['count']) + parseInt(tmpObj['count']); - }else{ - tmp.push(tmpObj); + // 按月度统计: + this.$refs.totalContent.style.display = 'none'; + let quarterItems = []; + for(let i=0;i<15;i++){ + // 初始化数据模板: + let tmpName = starNum2[i].name; + let tmpcount = starNum2[i].count; + let Quarter = parseInt(starNum2[i]['quarter']) - 1; + //对应该四个月的数量: + let monthCount = [0,0,0,0]; + // 应该存入的对应季度数组下标:quarterItems[starNum2[i]['quarter']] + monthCount[Quarter] = tmpcount; + //创建该折线数据对象: + let tmpObj = {'name':tmpName,'type':'line','data':monthCount}; + quarterItems.push(tmpObj); + } + for(let j=15;jitem['name'] == tmpName); + if(findSignal != -1){ + quarterItems[findSignal]['data'][Quarter] = tmpcount; } } + // for(let j=0;j<4;j++){ + // if(quarterItems[j] == undefined || quarterItems[j].length <= 0) { + // quarterItems.splice(j,1); + // console.log(j); + // } + // } + // 删除空元素 + // for(let j=0;j<4;j++){ + // if(quarterItems[j].length==0) quarterItems.splice(j,1); + // } + // let washData = [{'name':null,'data':[]}]; + // for(let p=0;p<10;p++){ + // for(let q=0;q