Archive for the 'Uncategorized' Category

Over Axis

Thursday, February 12th, 2009

Just finished some new work that I wanted to show.

This is accomplished via the new OverAxis decoration that will be included in the next Clicker release.

Over Grids

Sunday, December 21st, 2008

I’ve been reading Edward Tufte’s Visual Display of Quantitative Information and taking notes as I go. One of the things that stuck out was the use of a “white” grid, where the traditional background grid was rendered by erasing some of the data. Clicker was able to handle this after some small changes and tuning:

White Grid

Expect more features in the future that stem from Tufte’s work.

Clicker 2.0 And You

Thursday, July 17th, 2008

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!

Version 2.0 Examples

Saturday, July 12th, 2008

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.

Version 1.4.0

Saturday, October 20th, 2007

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 tick_labels 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, shape_stroke provides method for setting a stroke.

More Bar Renderer Improvements

Monday, October 15th, 2007

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.

Version 1.3.0

Monday, October 15th, 2007

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 hide_axes and hide_grid to Simple
  • StackedBar Renderer
  • Fix busted min/max of 0 on ranges
  • Real SVG support

Officially Stacked

Tuesday, October 9th, 2007

In the pending release:

It wasn’t so hard once I realized I was calling cairo’s rectangle function all wrong…

Version 1.2.2

Saturday, October 6th, 2007

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. Thanks to Stevan and friends for a great package.

The other exciting 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!

Version 1.1.8

Saturday, September 1st, 2007

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.

![Line with Shapes!](/clicker/images/line-shape.png)

I’ve just uploaded it to CPAN, happy charting!