July 17th, 2008 Clicker 2.0 And You
Today I released version 1.99_01 to the CPAN. Version 2.0 is substantially different — API wise — from 1.x. I’ll cover a few of the ways here.
No More Simple
Firstly, I removed Chart::Clicker::Simple because the core module is more simple than Simple.pm was. Here’s an example of the new API.
use Chart::Clicker; use Chart::Clicker::Data::Series; use Chart::Clicker::Data::DataSet; use Chart::Clicker::Renderer::Point; my $cc = Chart::Clicker->new; my $series = Chart::Clicker::Data::Series->new( keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], values => [ 42, 25, 86, 23, 2, 19, 103, 12, 54, 9 ], ); my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series ]); $cc->add_to_datasets($ds); $cc->prepare(); $cc->draw(); $cc->write('/Users/gphat/foo.png');
Contexts
Aside from the à la carte creation of charts, the major complication in Clicker’s API has always been the handling of multiple axes. My solution to this has been the introduction of contexts. A context is a domain axis, a range axis and a renderer. By default there is a single context called ‘default’. All datasets added to a chart are associated with the default context unless you specify otherwise, like so:
$dataset->context('sales');
You can create new contexts easily.
my $ctx = Chart::Clicker::Context->new( name => 'sales', renderer => Chart::Clicker::Renderer::Area->new ); $clicker->add_to_contexts($ctx);
Each context will be charted on unique axes and with whatever renderer it is set to. The upcoming cookbook will details advanced ways to change this behavior, but the default will over most people’s use cases.
Layout
Clicker previously required you to ‘add’ all the components of the chart manually. No longer! In removing Simple.pm I had Clicker simply add a set of default components. I’ll be working on a Cookbook for various customizations soon.
Under The Hood
The first major contribution to the 2.0 codebase was a patch from Ash Berlin that used Cairo’s clipping to replace the multiple-surface method that I had been using the past.
During YAPC::NA I added PDF and PostScript support and had a discussions with Guillermo and Stevan that pushed me to create a new stack underneath Clicker to facilitate some future features. I detailed these modules in a post on my personal blog.
In addition to the above Clicker is now Moose through-and-through, making extensive use of MooseX::AttributeHelpers.
2.0
I intend to release 2.0 soon, but there are still a few small bugs and missing features I want to complete. I also want to get started on the aforementioned Cookbook so that users can easily find out how to do advanced rendering. Stay tuned!
July 12th, 2008 Version 2.0 Examples
As a test tonight I generated new example images for the examples page. I found quite a few bugs to fix and ultimately generated some nice examples to drool over.
October 20th, 2007 Version 1.4.0
I’ve mentioned all the cool stuff in posts already, but here’s the list:
- Add ‘baseline’ attribute to Axis, Bar uses this to know when to draw ‘up’ or ‘down’.
- Fix incorrect coloring of text on customized axes.
- Add ticklabels to axes and expose it in Simple.
- Make axes and labels cope with letters that drop below the baseline.
- Mooseify renderer options into attributes (options method is no longer used)
- Fix warnings in tests.
- Line renderer shapes default to filled, shapestroke provides method for setting a stroke.
October 15th, 2007 More Bar Renderer Improvements
The Bar renderer has always been the red-headed stepchild of Clicker, but lately I’ve been paying it a lot more attention. Tonight I’ve added the ability to set the baseline of an Axis (at say, 0) so that Renderers can choose to display values differently if they fall above or below the baseline. Here’s the results for the Bar renderer:
I need to update the StackedBar renderer and get the axes ticks to take the baseline into effect before I can release the feature.
October 15th, 2007 Version 1.3.0
Some fixes came out of my time at PPW over the weekend. I also finally figured out how to do ‘real’ svg output!
- Sort of fix broken bar renderer
- Add hideaxes and hidegrid to Simple
- StackedBar Renderer
- Fix busted min/max of 0 on ranges
- Real SVG support
October 9th, 2007 Officially Stacked
In the pending release:
It wasn’t so hard once I realized I was calling cairo’s rectangle function all wrong…
October 6th, 2007 Version 1.2.2
A flurry of releases have brought us to 1.2.2. The single largest change has been the conversion to Moose. What originally began as an excuse to play with Moose turned into a desire to convert the whole of Clicker. Thannks to Stevan and friends for a great package.
The other excitiing feature is the addition of a Pie renderer:
1.2.2 fixed a few bugs that reared there heads after the Moose change. I’ve got a few changes that will give me a 1.2.3 in the near future.
Happy Charting!
September 1st, 2007 Version 1.1.8
It’s been a long time. I shouldn’t of left you. Without some dope code to chart to.
I skipped a couple of releases here, so we’ll cover them first.
- Version 1.1.6 removed some Mac OS X files from the tarball.
- Version 1.1.7 added a time_zone to Axis::DateTime via help from Johannes Hoerburger.
Version 1.1.8 began with a small bugfix from Johannes again, fixing a misnamed accessor. The hacking bug got me an in addition to that fix I made some speed improvments and added Shape support to the Line renderer.

I’ve just uploaded it to CPAN, happy charting!
February 24th, 2007 Version 1.1.5
Daniel Kasak noticed that bar charts with a single datapoint in the Series caused problems. I straightened it out and threw it up on CPAN. Happy Charting!
January 3rd, 2007 Version 1.1.4
A small bug in ColorAllocator reported by Johannes Hoerburger prompted me to work on a few odds and ends. Most notably the introduction if the Chart::Clicker::Simple class which significantly lowers the cost of admission for creating a chart with Clicker. It should hit CPAN in the next few hours.