Chart-Clicker
view release on metacpan or search on metacpan
lib/Chart/Clicker/Tutorial.pm view on Meta::CPAN
keys => [ 1,2,3,4,5 ],
values => [ 11,22,33,44,55 ]
));
# add a third color
$ca->add_to_colors($green);
$chart->add_to_datasets($dataset);
# assign the color allocator to the chart
$chart->color_allocator($ca);
$chart->write_output('chart.png');
=head2 Example 4 : Simple chart with a different render type
use Chart::Clicker;
use Chart::Clicker::Data::Series;
use Chart::Clicker::Data::DataSet;
# add in the module of the renerer(s) you want to use
use Chart::Clicker::Renderer::Area;
my $chart = Chart::Clicker->new;
my $series = Chart::Clicker::Data::Series->new(
keys => [ 1,2,3,4,5 ],
values => [ 52,74,52,82,14 ]
);
my $dataset = Chart::Clicker::Data::DataSet->new(
series => [ $series ]
);
$chart->add_to_datasets($dataset);
# build the renderer to use
my $renderer = Chart::Clicker::Renderer::Area->new(
opacity => .75,
);
# assign the renderer to the default context
$chart->set_renderer($renderer);
$chart->write_output('chart.png');
=head2 Example 5 : Width and Height
my $chart = Chart::Clicker->new(width => 1024, height => 768);
=head2 Example 6 : PDF (or SVG or PS)
my $chart = Chart::Clicker->new(format => 'pdf');
# Create the rest of your chart normally
$chart->write_output('chart.pdf');
=head2 Example 7 : Hide the Legend and X-Axis
my $chart = Chart::Clicker->new;
# hide the legend
$chart->legend->visible(0);
# hide the X-Axis
$chart->get_context('default')->domain_axis->hidden(1);
=head2 Example 8 : Change the display format of the Y-Axis
my $chart = Chart::Clicker->new;
# a sprintf format to have 3 decimal places showing on the Y-Axis
$chart->get_context('default')->range_axis->format('%.3f');
=begin :postlude
=head1 CONTRIBUTORS
Steve Bradford
Michael Peters
=end :postlude
=head1 DISCLAIMER
This is a work in progress. If you find errors or would like to make
contributions, drop me a line!
=head1 AUTHOR
Cory G Watson <gphat@cpan.org>
=head1 COPYRIGHT AND LICENSE
This software is copyright (c) 2016 by Cory G Watson.
This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.
=cut
( run in 0.820 second using v1.01-cache-2.11-cpan-39bf76dae61 )