Ledger Stats

September 2, 2011

Occasionally, I need to take a break from the projects I'm working on. How do I do that? By working on another project, of course!

Just over a year ago, I found ledger and began using it to manage my household finances. Some people may find that sort of thing boring, but I think it's it neat to look at the past year's worth of transactions, get a bird's eye view of our spending, identify trends, and so forth.

I've had it in the back of my mind lately that I'd like a better and preferably more visual way to do those things. After perusing through a few charting libraries, I found that Highcharts seem to do what I needed. Among other things, it provides a plugin for the the JavaScript library I'm most familiar with: jQuery.

I already had a bit of PHP code lying around to parse ledger's XML output, give me a monthly spending breakdown by account, and output it in CSV format. I lifted the parsing logic, wrote some more PHP to search transactions by several criteria based on form input, implemented a very simple plugin system to consume the search results and output various charts, and wrote a few simple plugins. Thus, ledger stats was born.

It's still in a very rough prototypical stage, but it's got enough functionality for others to start playing around with it. Feel free to fork it on GitHub and suggest improvements.