++ed by:
SARTAK ASB GETTY UKSZA ARJONES

19 PAUSE users
10 non-PAUSE users.

Cory G Watson

NAME

Chart::Clicker - Powerful, extensible charting.

DESCRIPTION

Chart::Clicker aims to be a powerful, extensible charting package that creates really pretty output. Charts can be saved in png, svg, pdf and postscript format.

Clicker leverages the power of Cairo to create snazzy 2D graphics easily and quickly.

At it's core Clicker is more of a toolkit for creating charts. It's interface is a bit more complex because making pretty charts requires attention and care. Some fine defaults are established to make getting started easier, but to really unleash the potential of Clicker you must roll up your sleeves and build things by hand.

The API is a bit intimidating, so it is recommended that you begin with Chart::Clicker::Simple.

WARNING

Clicker has aspirations to do more and be better. Good software is not Athena and therefore doesn't spring fully formed from the mind. It is entirely possible that new features will be added that may change behavior. You can find more information at http://www.onemogin.com/clicker. Feel free to send your criticisms, advice, patches or money to me as a way of helping.

CONTEXTS

The normal use case for a chart is a couple of datasets on the same axes. Sometimes you want to chart one or more datasets on different axes. A common need for this is when you are comparing two datasets of vastly different scale such as the number of employees in an office (1-10) to monthly revenues (10s of thousands). On a normal chart the number of employees would show up as a flat line at the bottom of the chart.

To correct this, Clicker has contexts. A context is a pair of axes, a renderer and a name. The name is the 'key' by which you will refer to the context.

  my $context = Chart::Clicker::Context->new( name => 'sales' );
  $clicker->add_to_contexts($context);
  
  $dataset->context('sales');
  
  $clicker->add_to_datasets($dataset);
  

New contexts provide a fresh domain and range axis and default to a Line renderer.

FORMATS

Clicker supports PNG, SVG, PDF and PostScript output.

SYNOPSIS

use Test::More tests => 3;

use Chart::Clicker::Data::Series; use Chart::Clicker::Data::Series::Size; 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 $series2 = Chart::Clicker::Data::Series->new( keys => [ 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 ], values => [ 67, 15, 6, 90, 11, 45, 83, 11, 9, 101 ], );

my $ds = Chart::Clicker::Data::DataSet->new(series => [ $series, $series2 ]);

$cc->add_to_datasets($ds);

$cc->prepare(); $cc->do_layout($cc); $cc->draw(); $cc->write('foo.png')

METHODS

Constructor

new

Creates a new Chart::Clicker object. If no format, width and height are specified then defaults of Png, 500 and 300 are chosen, respectively.

Instance Methods

add_to_contexts

Add the specified context to the chart.

add_to_datasets

Add the specified dataset (or arrayref of datasets) to the chart.

add_to_markers

Add the specified marker to the chart.

color_allocator

Set/Get the color_allocator for this chart.

context

Set/Get the context for this chart.

data

Returns the data for this chart as a scalar. Suitable for 'streaming' to a client.

datasets

Get/Set the datasets for this chart.

draw

Draw this chart

format

Get the format for this Chart. Required in the constructor. Must be on of Png, Pdf, Ps or Svg.

get_datasets_for_context

Returns an arrayref containing all datasets for the given context. Used by renderers to get a list of datasets to chart.

inside_width

Get the width available in this container after taking away space for insets and borders.

inside_height

Get the height available in this container after taking away space for insets and borders.

prepare

Prepare this chart for rendering.

write

Write the chart output to the specified location. Output is written in the format provided to the constructor (which defaults to Png).

  $c->write('/path/to/the.png');

AUTHOR

Cory 'G' Watson <gphat@cpan.org>

CONTRIBUTORS

Torsten Schoenfeld Ash Berlin

SEE ALSO

perl(1)

LICENSE

You can redistribute and/or modify this code under the same terms as Perl itself.