1
0
mirror of https://github.com/nikolaydubina/calendarheatmap.git synced 2025-02-08 03:41:02 +02:00
2020-07-11 19:17:13 +08:00
2020-07-03 15:26:05 +08:00
2020-07-11 17:31:58 +08:00
2020-07-02 03:00:58 +08:00
2020-07-11 19:01:50 +08:00
2020-07-11 19:16:11 +08:00
2020-07-02 02:30:49 +08:00
2020-07-03 10:03:26 +08:00
2020-07-03 10:03:26 +08:00
2020-07-02 02:30:49 +08:00
2020-07-11 19:16:11 +08:00
2020-07-11 19:16:11 +08:00

Go Report Card GoDev codecov Awesome

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

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,

$ go build

$ ./calendarheatmap -input testdata/basic.json -output basicjson.png

$ ./calendarheatmap -input testdata/custom.txt -output custom.png -input-format row-day-seconds-count

$ ./calendarheatmap -h

Usage of ./calendarheatmap:
  -colorscale string
        refer to colorscales for examples (default "PuBu9")
  -input string
        file should contain lines in format: 2020-05-16 20:43 PPPP (default "input.txt")
  -intput-format /parsers
        format of input file refer to /parsers for examples (default "json-basic")
  -labels
        labels for weekday and months (default true)
  -monthsep
        render month separator (default true)
  -output string
        output filename, will export as PNG (default "chart.png")
  -output-format string
        output format (png, jpeg, gif) (default "png")

TODO:

  • SVG support
  • select start and end date
Description
📅 Calendar heatmap inspired by GitHub contribution activity
https://calendarheatmap.io/ Readme MIT 33 MiB
Languages
Go 81.2%
HTML 16%
Makefile 2.8%