More Graphing with Perl

brian_d_foy on 2008-04-14T16:56:00

Following some good suggestions for improving the graphs on the CPAN Testers Statistics site, I looked into the Google Chart API. I was looking for something that was fairly simple to drop into what I already had with GD::Graph, and although a slight code edit was required, pretty much everything just worked. However, it wasn't without it's frustration. The data set that I pass is quite large with 6 sets of 100+ points each, such that the GET request fails, I assume because it gets truncated. As such I've had to reorganise the graphs, reducing the characters in the URL, and simplifying the presentation, although I wonder whether there is a way to POST the data. I didn't see anything on the site, but seeing as it's a free service, they may not want to be overloaded with complex graphing requirements.

On the plus side there is so much more I feel I can do with the API and the quality is heads and shoulders above anything I did with GD::Graph. There was a suggestion that I use SVG, and on searching CPAN I see Leo has SVG-TT-Graph, which might be good for local graph generation. The only downside at the moment for me with the Google API, is that I need to be connected to the internet. When generating the stats I'm sometimes offline, so Leo's distribution might be a better solution in the long run. Though, if you're looking to produce some nice fancy graphs and don't get too a high hit rate on your site, you would do well to investigate the Google Chart API.

It's been such a good experience I'm thinking of creating a talk about it now for the Perl dates on our World Tour. I've done the Selenium talk to death, so it would be fun to have something else in my repetoire :)


alternative: Open Flash Chart?

hossman on 2008-04-14T20:41:51

I think your screwed as far as volume of data goes. they seem to intentionally not support it...

http://code.google.com/apis/chart/#granularity

Have you looked at "Open Flash Chart" ? The graphs it produces can be extremely slick looking, and very interactive (both in terms of mouse over or clicking on elements of the graph and in using javascript via HTML form elements to auto update the data set) ... it can slurp it's data and options from a URL, which could be internet based, or a simple relative path for offline usage (just bundle the HTML, data, and SWF together)

http://teethgrinder.co.uk/open-flash-chart/

Re:alternative: Open Flash Chart?

barbie on 2008-04-15T07:02:21

Seeing as Google provide it as a free service, then I don't think it is unreasonable for them to set a maximum limit. However, as an interim solution it works for me. In the long run I'd rather create something that doesn't require an internet connection or rely on a remote provider.

The flash stuff looks interesting, and I'll certain investigate, but for the CPAN Testers stats stuff I'd rather use something fairly static, so it can work in most browsers without requiring plugins.

Re:alternative: Open Flash Chart?

hossman on 2008-04-15T16:22:34

i wasn't suggesting that they were being unreasonable, just that they seem to intentional limiting the volume of data, so i wouldn't hold your breath waiting for POST support in order to send more data.