Wednesday, April 11, 2001, at 03:30PM

By Eric Richardson

I'm very proud of myself. Click for the story...

So today I had the need to create bar graphs. Last summer I had written code to do pie graphs in GD, so I figured I would just look for a GD module for doing graphs and be all set. Sure enough, there's a GD::Graph module, and it does bar graphs.

Unfortunately, I don't like it. I just don't like how the graphs look. Maybe I'm just too picky, but they really aren't pretty graphs. Normally, I probably would have just gone ahead and used it despite that, but right now I'm on this huge trip from getting GTK-Perl and Imlib2_Perl to work for me. Somehow this makes me decide to write my own module for doing graphs using Imlib2_Perl.

Believe it or not, that's really not all that hard. The Imlib2 code for rectangles and such is really easy, so I got that pretty quickly.

Then I decided I really didn't like 2d graphs, even nice ones done with Imlib2. So I decide to do the whole draw polygons and make fake 3d bit. I look in Imlib2.h, find the appropriate C functions, and go to use them. It bails. I look in the Imlib2_Perl source and find nothing and polygons, just rectangles and ellipses.

So I end up managing to figure out how you add function definitions to a Perl xs file. I now have an Imlib2_Perl with working polygons. I now have cool looking semi-translucent 3d bar graphs.

I am happy.