Skip to content

Commit

Permalink
Merge pull request #39 from tomoish/fix-font
Browse files Browse the repository at this point in the history
Remove font in plot
  • Loading branch information
tomoish authored Feb 2, 2024
2 parents 9038aa0 + 1c524e7 commit 54d4387
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 26 deletions.
11 changes: 5 additions & 6 deletions src/graphs/commit_chart.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"image/color"

"gonum.org/v1/plot"
"gonum.org/v1/plot/font"
"gonum.org/v1/plot/plotter"
"gonum.org/v1/plot/vg"
// "github.com/fogleman/gg"
Expand Down Expand Up @@ -43,11 +42,11 @@ func DrawCommitChart(commitsHistory []int, maxCommits int, width int, height int
}
line.Color = color.RGBA{R: 135, G: 206, B: 235, A: 255}
p.Add(line)
plot.DefaultFont = font.Font{
Typeface: "Roboto-Medium.ttf",
Variant: "Roboto-Medium.ttf",
Size: 12.0,
}
// plot.DefaultFont = font.Font{
// Typeface: "Roboto-Medium.ttf",
// Variant: "Roboto-Medium.ttf",
// Size: 12.0,
// }
p.Title.Text = "Contribution History"
p.X.Label.Text = "Days"
p.Y.Label.Text = "Commits"
Expand Down
40 changes: 20 additions & 20 deletions src/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,30 +71,30 @@ import (

// }

// func getHistoryHandler(w http.ResponseWriter, r *http.Request) {
func getHistoryHandler(w http.ResponseWriter, r *http.Request) {

// // queryValues := r.URL.Query()
// // username := queryValues.Get("username")
queryValues := r.URL.Query()
username := queryValues.Get("username")

// // if username == "" {
// // http.Error(w, "username is required", http.StatusBadRequest)
// // return
// // }
if username == "" {
http.Error(w, "username is required", http.StatusBadRequest)
return
}

// username := "kou7306"
// username := "kou7306"

// _, dailyCommits, maxCommits, err := funcs.GetCommitHistory(username)
// if err != nil {
// http.Error(w, err.Error(), http.StatusInternalServerError)
// return
// }
_, dailyCommits, maxCommits, err := funcs.GetCommitHistory(username)
if err != nil {
http.Error(w, err.Error(), http.StatusInternalServerError)
return
}

// err = graphs.DrawCommitChart(dailyCommits, maxCommits, 1000, 700)
// if err != nil {
// fmt.Println(err)
// }
// http.ServeFile(w, r, "./images/commits_history.png")
// }
err = graphs.DrawCommitChart(dailyCommits, maxCommits, 1000, 700)
if err != nil {
fmt.Println(err)
}
http.ServeFile(w, r, "./images/commits_history.png")
}

// func getuserHandler(w http.ResponseWriter, r *http.Request) {

Expand Down Expand Up @@ -171,7 +171,7 @@ func main() {
// http.HandleFunc("/streak", getCommitStreakHandler)
// http.HandleFunc("/language", getLanguageHandler)
// http.HandleFunc("/character", getCharacterHandler)
// http.HandleFunc("/history", getHistoryHandler)
http.HandleFunc("/history", getHistoryHandler)
// http.HandleFunc("/user", getuserHandler)
// http.HandleFunc("/merge", mergeAllContents)
// http.HandleFunc("/background", getBackgroundHandler)
Expand Down

0 comments on commit 54d4387

Please sign in to comment.