2020-07-02 03:23:17 +08:00
|
|
|
[![Go Report Card](https://goreportcard.com/badge/github.com/nikolaydubina/calendarheatmap)](https://goreportcard.com/report/github.com/nikolaydubina/calendarheatmap)
|
2020-07-03 10:36:53 +08:00
|
|
|
[![GoDev](https://img.shields.io/static/v1?label=godev&message=reference&color=00add8)](https://pkg.go.dev/github.com/nikolaydubina/calendarheatmap)
|
2020-07-02 03:02:18 +08:00
|
|
|
|
2020-07-02 03:04:05 +08:00
|
|
|
Self-contained, plain Go implementation of calendar heatmap inspired by Github contribution activity.
|
2020-07-02 03:02:51 +08:00
|
|
|
|
2020-07-02 02:48:34 +08:00
|
|
|
Colorscales
|
2020-07-03 10:13:26 +08:00
|
|
|
![PuBu9](examples/chart_PuBu9.png)
|
|
|
|
![GnBu9](examples/chart_GnBu9.png)
|
|
|
|
![YlGn9](examples/chart_YlGn9.png)
|
2020-07-02 02:48:34 +08:00
|
|
|
|
2020-07-02 02:50:20 +08:00
|
|
|
Without month separator
|
2020-07-03 10:13:26 +08:00
|
|
|
![PuBu9_noseparator](examples/chart_PuBu9_noseparator.png)
|
2020-07-02 02:48:34 +08:00
|
|
|
|
2020-07-02 20:07:08 +08:00
|
|
|
Without labels
|
2020-07-03 10:13:26 +08:00
|
|
|
![PuBu9_noseparator](examples/chart_PuBu9_nolabels.png)
|
2020-07-02 20:07:08 +08:00
|
|
|
|
|
|
|
Without labels, without separator
|
2020-07-03 10:13:26 +08:00
|
|
|
![PuBu9_noseparator](examples/chart_PuBu9_noseparator_nolabels.png)
|
2020-07-02 20:07:08 +08:00
|
|
|
|
2020-07-03 09:54:43 +08:00
|
|
|
Example:
|
|
|
|
|
|
|
|
```go
|
|
|
|
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,
|
|
|
|
...
|
|
|
|
})
|
|
|
|
```
|
|
|
|
|
2020-07-02 02:51:38 +08:00
|
|
|
You can run it in your Go code or as standalone script.
|
2020-07-03 10:12:28 +08:00
|
|
|
Check full example at `examples/main.go` and `input.txt` for more details.
|
2020-07-03 10:13:26 +08:00
|
|
|
Generate examples above with `./generate_examples.sh`.
|