diff --git a/src/components/Ranking/Ranking.vue b/src/components/Ranking/Ranking.vue index 139ff99..7768d23 100644 --- a/src/components/Ranking/Ranking.vue +++ b/src/components/Ranking/Ranking.vue @@ -13,10 +13,10 @@
- - + + + + + + GitHub官网数据汇总 + + + - -
+ + + + GitHub官网数据统计图 + + + +
@@ -127,7 +141,7 @@ export default { value1: false, // 默认用户选择的分类 selectedValue:['1','2'], - selectedValueByYear:2023, + selectedValueByYear:null, } }, updated(){ @@ -142,7 +156,6 @@ export default { }, mounted() { this.initPage(); - window.open('/', '_self'); console.log(this.showData); }, methods: { @@ -156,14 +169,13 @@ export default { initPage(){ var that = this; that.formName=['语言种类','获得星数']; - this.getNumData(2023,false); - setTimeout(()=>{ - this.getRenderer(); - },1000); + // this.getNumData(2023,false); + // this.getRenderer(); }, - FreshPage(type){ + FreshPage(type,index){ var that = this; + if(index == true) that.selectedValueByYear = 11; // console.log(that.selectedValueByYear); type = type[type.length-1] - 1; let year = that.selectedValueByYear + 2012; @@ -193,8 +205,9 @@ export default { var that = this; that.showData = []; let starNum2 = that.starNum.filter(item => item['year'] == year); - let tmp = []; if(index == false){ + let tmp = []; + // 按年度统计: for(let i=0;iitem['name'] == tmpObj['name']); @@ -204,10 +217,31 @@ export default { tmp.push(tmpObj); } } - that.showData = tmp.slice(0,20); + that.showData = tmp.slice(0,18); that.showData = that.showData.sort(compare('count')); // 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); + } + } } }, @@ -256,7 +290,7 @@ export default { } }], grid: { - x: '10%', + x: '18%', y: 0, x2: '10%', y2: 0