Recently, I’ve been wanting to create some timelines for various projects of mine. I needed something fairly flexible and I wanted the timeline to be generated from an input file, not from source code or a GUI. I settled on MG_TIMELINE which accepts an XML input file and generates a PostScript output file (which I can then convert to PNG or PDF, depending on what I need). While MG_TIMELINE is not a finished solution yet, it does handle my needs fairly well now.

To run the main-level example program, just put all the required files in the !path and type:

IDL> .run mg_timeline


The input file contains a top-level timeline element which specifies the start and end dates as well as the tick interval:

<timeline start="10-4-2009" end="10-3-2010" ticks="weeks"
color="black">


If you want a vertical line at the current date, put in a now element:

<now color="orangered"/>


Currently, there are three types of items to place on the timelines: event, interval, and activity elements. Examples of these elements from the athletic.xml file are shown below. Events are at a specific date:

<event color="dodgerblue" date="7-18-2010" level="1">
!4GRUB!XBoulder, CO
</event>


The color name can be any of the HTML color names. The level attribute specifies the height of the text for the level where 0.1 is the bottom timeline axis and 0.9 is the top timeline axis (I trying to think of ways to make this friendlier). An interval is similar except it has start and end dates:

<interval start="6-1-2010" end="10-3-2010" name="!4Competitive!X"
level="2.0" color="forestgreen"/>


An activity element specifies some value for each time period of the timeline. Below is a weekly activity which starts on the 17th week, so the value for the 17-19th weeks is 5, 20-22 is 6, etc.:

<activity report="weekly" name="!4sprinting!X" start="17"
level="6.75" color="orange">
5 5 5 6 6 6 7 7 7 8 8 8 9 9 9 10 10 10 11 11 11 12 12 12
13 13 14 14 14 15 15 15 10 10 10 5
</activity>


It would be nice to add a sparkline visualization option for activities.

Here’s the source code, the data for the example, and the documentation. You will also need VIS_COLOR and its data. The output is available as a image or PDF.