On my website home page, I have a "sparkline" that shows all of my contributions to the IndieWeb wiki. The sparkline doesn't show any specific values. The goal is to show my activity and trends contributing to the wiki as opposed to showing exactly how many contributions I have made. I enjoy this visualization. Every time I go to my home page I get a quick reminder about how often I have contributed to the IndieWeb wiki. Sometimes I look and realise I contributed a lot; sometimes I see I contribute more in bursts.
To generate this sparkline, I use a web application I wrote. The web application accepts a username and a MediaWiki API endpoint and returns an SVG file with a sparkline. This application:
- Queries the
usercontribsobject on the specified MediaWiki API;
- Calculates how many contributions have been made for each day in the last 90 days. If no contributions were made in a day, a 0 is assigned for that day.
- Turns the number of contributions made each day into a list that is passed to a "sparkline" SVG file made by Stuart Langridge. This list is passed as a query string parameter to the SVG file.
- The SVG takes the query string and draws lines using the provided values.
Here is a sparkline that shows my last 90 days of contribution history to the IndieWeb wiki:
To use the script, take the following URL and substitute the username and API endpoint URLs with your MediaWiki username and API endpoint:
Note: The MediaWiki API must be enabled on your instance for this tool to work.
The URL will then redirect you to an SVG file that you can embed on your website. By default, a sparkline is generated for the last 90 days of contribution history. However, this can be overwritten using a custom
days parameter. To show 30 days of contribution history, for example, you could pass the
days=30 query string parameter.
To embed the SVG on your website, you can use the HTML
When you load your web page, you'll have an SVG sparkline that shows your wiki contributions!
This project is open source and licensed under an MIT 0 license. If you have ideas on how the project could be improved, or if you want to report a bug, feel free to submit an Issue to the project repository.
Comment on this post
Respond to this post by sending a Webmention.
Have a comment? Email me at email@example.com.