in reply to Getting mysql data into gd

In case you are still looking for a way to transpose data:
in mysql:
https://stackoverflow.com/questions/3392956/sql-how-to-transpose.

Of course, perl can do the transpose as well (but it is probably more memory-efficient to do it in SQL):
https://stackoverflow.com/questions/3249508/transpose-in-perl.

                All power corrupts, but we need electricity.