The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Chart::Clicker - Powerful, extensible charting.

DESCRIPTION

Chart::Clicker aims to be a powerful, extensible charting package that creates really pretty output.

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.

WARNING

Clicker is in heavy development. The interface is not optimal, there are features missing, and pieces of it flat out do not work. Good software is not Athena and therefore doesn't spring fully formed from the mind. It will take some time to nail down the interface. 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.

SYNOPSIS

  use Chart::Clicker;
  use Chart::Clicker::Axis;
  use Chart::Clicker::Data::DataSet;
  use Chart::Clicker::Data::Series;
  use Chart::Clicker::Decoration::Grid
  use Chart::Clicker::Decoration::Legend
  use Chart::Clicker::Decoration::Plot
  use Chart::Clicker::Drawing qw(:positions);
  use Chart::Clicker::Drawing::Insets;
  use Chart::Clicker::Renderer::Area

  my $c = new Chart::Clicker({ width => 500, height => 350 });

  my $series = new Chart::Clicker::Data::Series({
    keys    => [1, 2, 3, 4, 5, 6],
    values  => [12, 9, 8, 3, 5, 1]
  });

  my $dataset = new Chart::Clicker::Data::DataSet({
    series => [ $series ]
  });

  my $legend = new Chart::Clicker::Decoration::Legend({
    margins => new Chart::Clicker::Drawing::Insets({
        top => 3
    })
  });
  $chart->add($legend, $CC_BOTTOM);

  my $daxis = new Chart::Clicker::Axis({
    orientation => $CC_HORIZONTAL,
    position    => $CC_BOTTOM,
    format      => '%0.2f'
  });
  $chart->add($daxis, $CC_AXIS_BOTTOM);

  my $raxis = new Chart::Clicker::Axis({
    orientation => $CC_VERTICAL,
    position    => $CC_LEFT,
    format      => '%0.2f'
  });
  $chart->add($raxis, $CC_AXIS_LEFT);

  $chart->range_axes([ $raxis ]);
  $chart->domain_axes([ $daxis ]);

  my $grid = new Chart::Clicker::Decoration::Grid();
  $chart->add($grid, $CC_CENTER, 0);

  my $renderer = new Chart::Clicker::Renderer::Area();
  $renderer->options({
    fade => 1
  });

  my $plot = new Chart::Clicker::Decoration::Plot();
  $plot->renderers([$renderer]);

  $chart->add($plot, $CC_CENTER);

  $chart->prepare();
  $chart->draw();
  $chart->write('/path/to/chart.png');

METHODS

Constructor

new

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

Class Methods

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.

draw

Draw this chart

prepare

Prepare this chart for rendering.

set_dataset_domain_axis
  $chart->set_dataset_domain_axis($dataset_index, $axis_index)

Affines the dataset at the specified index to the domain axis at the second index.

get_dataset_domain_axis
  my $axis = $chart->get_dataset_domain_axis($index)

Returns the domain axis to which the specified dataset is affined.

set_dataset_range_axis
  $chart->set_dataset_range_axis($dataset_index, $axis_index)

Affines the dataset at the specified index to the range axis at the second index.

get_dataset_range_axis
  my $axis = $chart->get_dataset_range_axis($index)

Returns the range axis to which the specified dataset is affined.

write

Write the resulting png file to the specified location.

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

Returns the PNG data as a scalar.

AUTHOR

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

SEE ALSO

perl(1)

LICENSE

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