Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit1eb6573

Browse files
committed
Show repo types pie chart on coder page
1 parent953324f commit1eb6573

File tree

4 files changed

+72
-3
lines changed

4 files changed

+72
-3
lines changed

‎README.md‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
11
#README
22

3-
Source files for[coderstats.net](https://coderstats.net/).
3+
Source files for[coderstats.net](https://coderstats.net/).
4+
5+
#GitHub API Calls
6+
7+
*https://api.github.com/search/issues?q=user:yaph&sort=created&order=desc
8+
*https://api.github.com/users/yaph/events/public
9+
*https://api.github.com/users/yaph/received_events/public

‎src/js/coder.js‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,36 @@ let coder = new Vue({
5757
forks:function(){
5858
returnthis.repoRanking('forks_count');
5959
},
60+
repo_types:function(){
61+
letlabels=[];
62+
letvalues=[];
63+
lettypes={
64+
active_sources:0,
65+
archived:0,
66+
disabled:0,
67+
forked:0,
68+
mirrors:0
69+
};
70+
for(letrepoofthis.repos_pushed){
71+
if(repo.archived)
72+
types.archived++;
73+
elseif(repo.disabled)
74+
types.disabled++;
75+
elseif(repo.fork)
76+
types.forked++;
77+
elseif(repo.mirror)
78+
types.mirrors++;
79+
else
80+
types.active_sources++;
81+
}
82+
for(let[label,value]ofObject.entries(types)){
83+
if(value>0){
84+
labels.push(label);
85+
values.push(value);
86+
}
87+
}
88+
return{labels:labels,values:values};
89+
},
6090
stars:function(){
6191
returnthis.repoRanking('stargazers_count');
6292
},
@@ -99,6 +129,10 @@ let coder = new Vue({
99129
this.rankingGraph(this.issues.slice(0,10),'open_issues_count','#issues-ranking');
100130
this.rankingGraph(this.forks.slice(0,10),'forks_count','#forks-ranking');
101131
this.rankingGraph(this.stars.slice(0,10),'stargazers_count','#stars-ranking');
132+
133+
newChartist.Pie('#repo-types-chart',{
134+
labels:this.repo_types.labels.map(d=>d.replace('_',' ')),
135+
series:this.repo_types.values});
102136
},
103137
methods:{
104138
fetchRepos:function(){

‎src/scss/coder.scss‎

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,30 @@
3232
stroke:$color2;
3333
}
3434

35+
.ct-chart-pie {
36+
min-height:250px;
37+
}
38+
39+
.ct-chart-pie.ct-label {
40+
fill:#222;
41+
}
42+
43+
.ct-series-a.ct-slice-pie {
44+
fill:rgb(141,211,199)
45+
}
46+
.ct-series-b.ct-slice-pie {
47+
fill:rgb(255,255,179)
48+
}
49+
.ct-series-c.ct-slice-pie {
50+
fill:rgb(190,186,218)
51+
}
52+
.ct-series-d.ct-slice-pie {
53+
fill:rgb(251,128,114)
54+
}
55+
.ct-series-e.ct-slice-pie {
56+
fill:rgb(128,177,211)
57+
}
58+
3559
.meta {
3660
background-color:$color4;
3761
}

‎templates/coder.html‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
{% raw %}
2323
<divid="coder">
2424
<divv-if="user"class="row">
25-
<divclass="col-12 col-2-xl col-2-l col-4-m meta">
25+
<divclass="col-12 col-2-xl col-3-l col-4-m meta">
2626
<divclass="padh">
2727
<header>
2828
<h3>{{ user.name }}</h3>
@@ -34,12 +34,17 @@ <h3>{{ user.name }}</h3>
3434
<spanv-if="user.location"class="block"><iclass="fa fa-globe"aria-hidden="true"></i> {{ user.location }}</span>
3535
<spanv-if="user.company"class="block"><iclass="fa fa-money"aria-hidden="true"></i> {{ user.company }}</span>
3636
<blockquotev-if="user.bio"><p>{{ user.bio }}</p></blockquote>
37+
38+
<divv-if="repo_types"class="padv">
39+
<h3>Repo types</h3>
40+
<divid="repo-types-chart"></div>
41+
</div>
3742
</div>
3843
</div>
3944
<divv-if="repos_pushed.length < 2"class="col-12 error">
4045
{{ user.name }} has not pushed changes to enough public repositories to show any interesting data here.
4146
</div>
42-
<divv-elseclass="col-12 col-10-xl col-10-l col-8-m no-padding main">
47+
<divv-elseclass="col-12 col-10-xl col-9-l col-8-m no-padding main">
4348
<divclass="flex flex-wrap boxes">
4449
<divclass="box-stat"title="The number of loaded repositories this user has pushed to.">
4550
<iclass="fa fa-code"aria-hidden="true"></i> Pushed to repos

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp