[reportlab-users] time series lineplot

Robin Becker reportlab-users@reportlab.com
Thu, 18 Sep 2003 19:35:21 +0100

In article <38966.>
, reportlab@sarcastic-horse.com writes
>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:

looks real nice, perhaps if you don't mind we might do a contrib spread
on our upcoming revamped web site? It's a nice example of what can be
done with a bit of effort.

>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.

We have such a beast already though it's not so fancy as yours. It uses
normalDate.py for the dating. Doing the frequency is pretty hard.

>_Figure out how to deal with multi-line titles.  The chart area should
>squeeze down.

Squeezing is pretty easy with Andy's new getBounds stuff. You need to
defer all decisions till draw time though. That's when you get to know
the sizes accurately.

>_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.

Robin Becker