May 23rd, 2009 Using User-Installed Fonts with Clicker

If you are a Mac user and have tried to use fonts that you installed in your local Fonts directory, you may have had some trouble. I’ve tried to fix this a few times, but never found the hint I needed. Today that changed!

Create a ~/.fonts.conf that contains the following:

<?xml version="1.0"?>
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
<!-- /etc/fonts/fonts.conf file to configure system font access -->
<fontconfig>
 
<!-- Font directory list -->
<!-- Add to system list -->
 
        <dir>/System/Library/Fonts</dir>
        <dir>/Library/Fonts</dir>
        <dir>~/Library/Fonts</dir>
 
</fontconfig>

This should enable any font-config enabled application to find your precious fonts!

Posted in Uncategorized


May 8th, 2009 New Renderer: CandleStick

This has been on my list for quite some time and tonight I finally got around to it.

It’s included in the latest release, just uploaded to CPAN.

Posted in Features, Releases


May 2nd, 2009 Proper Text Rotation

The just-uploaded 2.24 release of Chart::Clicker depends on a fresh release of the Graphics::Primitive Cairo driver. This is important because Clicker’s ornery text-rotation bug is now gone. Previously, rotation didn’t calculate a bounding box, it instead allocated space that was a square as big as original box’s largest dimension. The yield can be seen quickly in this composite of a before (0.36) and after (0.37) shot of a simple chart:

You can see how much space was wasted on the vertical y-axis label. On the right things are sized properly.

The only other “major” bug I’ve got hanging around in Clicker is an overflow bug due to broken legend wrapping. I’ll attack this next.

Posted in Features, Releases


April 27th, 2009 Refining The Line

The latest release of Clicker fixes some undocumented behavior of the Line renderer and makes it easier to add borders to shapes added to the line, like so:

This is a comment effect used in many modern charts. I’m not sure as to the utility of it, but it increases the ink-to-data ratio, thereby passing one of the tests installed by my study of Tufte.

You can use this feature in the upcoming 2.23 release.

Posted in Features, Releases


April 5th, 2009 New Renderer: Stacked Line

Well, not really new. The Line renderer is now capable of producing stacked output. All you need to do is set the additive attribute to a true value!

Stacked Line

This will be available on the 2.22 release, being uploaded to CPAN now.

Posted in Features, Releases


March 27th, 2009 New Renderer: Stacked Area

Per a few requests, I implemented a Stacked Area renderer tonight:

Stacked Area

I also fixed a bug in StackedBar, adjusted “fade” gradients in and made some other small improvements. Version 2.20 was just uploaded to the CPAN.

Posted in Features, Releases


February 12th, 2009 Over Axis

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.

Posted in Uncategorized


December 21st, 2008 Over Grids

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.

Posted in Uncategorized


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!

Posted in Uncategorized


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.

Posted in Uncategorized