[reportlab-users] time series lineplot

reportlab-users@reportlab.com reportlab-users@reportlab.com
Thu, 18 Sep 2003 13:09:17 -0400 (EDT)


About two weeks ago, I asked if reportlab would be capable of making a
chart that looked similar to this powerpoint chart:


The chart is a lineplot that also shows shaded vertical bars that indicate

After tinkering for a while, this is what I've created with reportlab:


I just wanted to thank all the people on this list with all the tips.

The chart uses mx.DateTime.Date objects to set the boundaries of the
x-axis.  It is easy to to change the start dates and end dates of the
graph, and the recession bars (those yellow vertical bars) and the data
will shift around.  The text labels in the chart are still fixed, but
that's a next detail.

Right now, I'm just reading data in from text files, but in the real
application I have in mind, data will be stored in SQL databases, and this
whole system will be web-driven.

This is what I'm going to work on next:
_Allow adding text to the fields using x and y axis coordinates rather
than absolute (x,y) drawing coordinates.  For example, I want to make it
possible to draw a text field at ('January, 1980', 75%).
_Add support for quarterly and annual frequency data.
_Make a proper timeseriesLinePlot class that has startdate, enddate, and
frequency attributes.
_Figure out how to deal with multi-line titles.  The chart area should
squeeze down.
_Learn the legend class and add that in automatically.

If anyone is interested, the source code that made these charts is here:


I'd love to hear suggestions about how to improve the code.

To run the charts yourself, you'll need the data, which is here:


This data is all from the Federal Reserve Board of Governors and is freely
available (although in a different format) from their website:


Anyway, like I said above, thanks to everyone on this list.  I hope to
automate my office's production of these slides and this is a very
encouraging start.