in Projects

Creating GitHub-Style Contribution Graphs for Anything

You can use akerl’s excellent GithubChart tool from GitHub to create contribution graphs using any data you want. Compare my current GitHub streak:

Your browser does not support SVG
versus all of my repos, public and private:

Your browser does not support SVG

(You’ll notice differences on the days that I closed issues and opened pull requests through GitHub).

How to create contribution graphs for private repos:

You can use a tool like fakehubstats to generate JSON data about local repositories and feed it into GithubChart: /path/to/lots/of/repos/* | githubchart -i - /wherever/you/want/to/save.svg

You can run gem install githubchart, and requires the JSON and DateTime perl modules. On Debian, it’s as easy as running apt-get install libdatetime-perl libjson-perl. You can, of course, use your preferred method of installing perl modules too!

The fakehubstats README includes two one-liners to help explore and intermingle the GitHub data with your own.There’s a jq command that combines both JSON files by using the maximum value of either day. This isn’t perfect, but should get you a square on your custom chart for days where you did GitHub-specific maintenance.

Other uses

With this new feature you can turn lots of streak-like data into progress charts. You can take habit-related data and turn it into a contribution graph, or you could turn your web history into a depressing chart (how many times did I go on HackerNews yesterday?). You could take savings data and use the contribution amounts as dollars saved per-day. Try it out!

Write a Comment