mirror of
https://github.com/tiennm99/ghstats.git
synced 2026-05-23 14:24:58 +00:00
refactor: match github-profile-summary-cards chart styles
- Productive time is now a 24-hour bar chart with axes and nice tick labels instead of a 7x24 heatmap. Model Productive field reshaped from [7][24]int to [24]int. - Language cards render as donut charts with a left-side legend instead of a stacked bar. Slices beyond top-6 collapse into an "Other" row. - Add niceTicks helper (1/2/5 * 10^k ladder, d3-style) for axis ticks. - Legacy language_bar.go removed.
This commit is contained in:
@@ -35,8 +35,8 @@ type Profile struct {
|
||||
// primary language, sorted desc. Populated by FetchProductive.
|
||||
CommitsByLanguage []LangStat
|
||||
|
||||
// Commit-count histogram indexed by [day-of-week 0=Sunday][hour-of-day 0-23].
|
||||
Productive [7][24]int
|
||||
// Commit counts grouped by hour-of-day (0-23) in the configured timezone.
|
||||
Productive [24]int
|
||||
|
||||
// TopRepos are owned repos sorted by stargazer count desc. Populated by
|
||||
// FetchProfile and consumed by FetchProductive.
|
||||
|
||||
@@ -23,7 +23,7 @@ type productiveGQL struct {
|
||||
} `json:"repository"`
|
||||
}
|
||||
|
||||
// FetchProductive fills p.Productive with a [7][24] commit histogram over the
|
||||
// FetchProductive fills p.Productive with a 24-hour commit histogram over the
|
||||
// last year and p.CommitsByLanguage with commit counts attributed to each
|
||||
// repo's primary language. Commits are gathered from the given repos (usually
|
||||
// p.TopRepos[:N]); each repo is sampled up to maxPerRepo commits to keep the
|
||||
@@ -71,8 +71,7 @@ func (c *Client) FetchProductive(p *Profile, repos []RepoInfo, loc *time.Locatio
|
||||
if err != nil {
|
||||
continue
|
||||
}
|
||||
tl := t.In(loc)
|
||||
p.Productive[int(tl.Weekday())][tl.Hour()]++
|
||||
p.Productive[t.In(loc).Hour()]++
|
||||
if repo.PrimaryLanguage != "" {
|
||||
commitsByLang[repo.PrimaryLanguage]++
|
||||
if _, ok := langColor[repo.PrimaryLanguage]; !ok {
|
||||
|
||||
Reference in New Issue
Block a user