1
0
mirror of https://github.com/nikolaydubina/calendarheatmap.git synced 2024-12-05 03:58:50 +02:00
📅 Calendar heatmap inspired by GitHub contribution activity https://calendarheatmap.io/
Go to file
2020-09-29 20:18:22 +08:00
.github/workflows Create go.yml 2020-07-03 15:26:05 +08:00
charts fix korean 2020-09-29 20:18:22 +08:00
colorscales lint 2020-07-02 03:00:58 +08:00
parsers +example 2020-07-11 19:01:50 +08:00
testdata better json data example; +readme example 2020-07-11 20:56:29 +08:00
.gitignore Initial commit 2020-07-02 02:30:49 +08:00
go.mod mod tidy 2020-09-29 20:02:44 +08:00
go.sum mod tidy 2020-09-29 20:02:44 +08:00
LICENSE Initial commit 2020-07-02 02:30:49 +08:00
main.go added UTF-8 support 2020-09-29 20:02:08 +08:00
README.md Update README.md 2020-07-13 13:46:59 +08:00

Go Report Card GoDev codecov Awesome

Self-contained, plain Go implementation of calendar heatmap inspired by Github contribution activity.

$ go build
$ echo '{
    "2020-05-16": 8,
    "2020-05-17": 13,
    "2020-05-18": 5,
    "2020-05-19": 8,
    "2020-05-20": 5
}' | ./calendarheatmap > chart.png

Basic

basic

Colorscales col1 col2

Without month separator nosep

Without labels nolab

Without labels, without separator nosep_nolab

Example module, next save output in formats supported by image module (PNG, JPEG, GIF).

countByDayOfYear := map[int]int{
    1: 10,
    22: 15,
    150: 22,
    366: 55,
    ...
}

img := charts.NewHeatmap(charts.HeatmapConfig{
    Year:               2020,
    CountByDay:         countByDay,
    ColorScale:         colorscales.PuBu9,
    DrawMonthSeparator: true,
    DrawLabels:         true,
    ...
})

Example script

$ cat testdata/basic.json | ./calendarheatmap -output jpeg > chart.jpeg
$ cat testdata/custom.txt | ./calendarheatmap -input row-day-seconds-count > custom.png
$ ./calendarheatmap -h

Usage of ./calendarheatmap:
  -colorscale string
        refer to colorscales for examples (default "PuBu9")
  -input string
        format of input file, refer to parsers module (default "json-basic")
  -labels
        labels for weekday and months (default true)
  -monthsep
        render month separator (default true)
  -output string
        output format (png, jpeg, gif) (default "png")