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.
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.
FORMATS
Clicker supports PNG and SVG output.
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 $chart = 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 ]
});
$chart->datasets([ $dataset ]);
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 chart output to the specified location. Choose a format based on the extension of the filename you provide. You may optionally specify the format to override the guessing. If you confuse it, it will default to a PNG.
$c->write('/path/to/the.png');
- png
-
Returns the PNG data as a scalar.
- svg
-
Returns the SVG data as a scalar.
AUTHOR
Cory 'G' Watson <gphat@cpan.org>
CONTRIBUTORS
Torsten Schoenfeld
SEE ALSO
perl(1)
LICENSE
You can redistribute and/or modify this code under the same terms as Perl itself.