It’s happened a number of times now that I’m writing a piece of software that needs charts of some sort. Sometimes I’ll need a line chart, sometimes a bar chart, a pie chart, maybe even a Gauss diagram. There are cases that I’ll need a tiny chart that’s not too accurate but shows a tendency, shown as a bitmap (what seems to be called “sparklines”), and sometimes I’ll need a detailed line chart of visitors to a site by month, or number of pushups by day for a member of a gymnasium, or even a world map with data by country. I’ve done projects needing such charts in C#, in PHP, and in Flash.

There’s a problem: there doesn’t seem to be any (quality) free charts package out there. Good packages for PHP are commercial (i.e. JpGraph), but there’s open source stuff available (e.g. pChart) but this is obviously not portable to C#, or Flash. The Google Charts API seems to be the most flexible thing out there, but obviously it’s only available on the web and only for sites that are actually online, i.e. not for intranets. Yet Google Charts is exactly what I want: well thought out, easy to use, very flexible.

Since the backbone of a charts library is some math that allows us to calculate the axes, projection of points on the chart, creating the legend etc., it should be written in a portable way so that it becomes available and reusable in multiple programming languages. Google’s Charts API could be the basis for how charts are specified.

What I’d really like to do is write the algorithms to produce various chart types in pseudocode, so that they could then be implemented in various programming languages, possible then using the Decorator pattern to add features that are language-specific (lots of interesting things can be done with Flash, like mouseovers and zooming).

This’ll be a pet project for a while…