Perl Module Monday: Chart::Clicker
I’ve been interested in the Chart::Clicker package for a while, and today it came up in a series of Twitter messages in my #perl search. So that seemed like a sign that it would be a good pick for this week’s feature.
Chart::Clicker is a mature, very feature-rich charting package that comes with a cookbook and many examples (the code for the examples is available on GitHub). There’s also a tutorial POD in the distribution. It does pie charts, line graphs, bar graphs, area graphs, stacked bar or area or line graphs, points, bubbles, or candlestick-style charts. In short, it makes pretty pictures in Perl:
The above is just one of the images shown as examples of what Chart::Clicker can do.
The module bases its rendering on Graphics::Primitive, specifically Graphics::Primitive::Driver::Cairo. This means it can render the chart in any format Cairo supports; PNG, PDF, even SVG among others. The internal object-model is based on Moose, which leads to keeping potentially-duplicate code to a minimum. Using the package is about as complex as you need your graph to be: a simple graph with a single set of data can be created in just 5 lines of code or so, while some of the examples are much more complicated scripts.
I’m surprised to see (according to CPANTS) that this module is not a component in any other packages’ lists of dependencies. It would seem to me to be a logical bit of functionality to integrate into a Catalyst view, or any stats package. I won’t be surprised if this changes in the near future, as (hopefully) more people start using the package.
Tags: CPAN, module-monday, Perl