Catalyst-View-Chart-Strip
view release on metacpan or search on metacpan
lib/Catalyst/View/Chart/Strip.pm view on Meta::CPAN
package Catalyst::View::Chart::Strip;
use strict;
use base qw/Catalyst::View/;
use UNIVERSAL::require;
use Carp;
use NEXT;
our $VERSION = '0.05';
=head1 NAME
Catalyst::View::Chart::Strip - A Catalyst View for Chart::Strip graphics
=head1 SYNOPSIS
package MyApp::View::ChartStrip;
use strict;
use base 'Catalyst::View::Chart::Strip';
__PACKAGE__->config(
cs_package => 'Chart::Strip',
height => 192,
width => 720,
limit_factor => 1,
transparent => 0,
img_type => 'png',
palette => [qw/
FF0000
00CC00
0000FF
CC00CC
/],
);
1;
# A controller method which generates a chart:
sub thechart : Local {
my ( $self, $c ) = @_;
[ ... generate $data and $opts somehow or other ... ]
$c->stash->{chart_opts} = $opts;
$c->stash->{chart_data} = $data;
$c->forward('MyApp::View::ChartStrip');
}
=head1 DESCRIPTION
This view allows the serving of Chart::Strip stripchart graphics
via Catalyst. The raw numeric data and various chart options are
placed in C<$c-E<gt>stash>.
Instances of L<Catalyst::View::Chart::Strip>, like
C<MyApp::View::ChartStrip> shown in the synopsis above, can be thought
of as basically a collection of common defaults for the various chart
options. You should probably create a seperate View class for each
distinct style of charts your application commonly generates.
All of the standard constructor arguments documented by L<Chart::Strip>
are supported as C<-E<gt>config> parameters in your View class, and are
also overrideable at chart generation time via
C<$c-E<gt>stash-E<gt>{chart_opts}>.
L<Catalyst::View::Chart::Strip> adds a few new options in addition to
the ones that are standard in L<Chart::Strip>, which are detailed below.
=head1 CONFIGURATION PARAMETERS
(See L<Chart::Strip> for a complete list of options. Any L<Chart::Strip>
option can be passed through as a C<-E<gt>config> parameter).
All of these options are valid both a C<-E<gt>config> time, or at chart
generation time via C<$c-E<gt>stash-E<gt>{chart_opts}>.
=head2 img_type
Sets the output image type. Values currently supported by L<Chart::Strip>
and L<GD> beneath it are C<png> and C<jpeg>. The default is C<png> if
unspecified.
=head2 quality
This is the quality parameter for the output graphics data, as documented
in detail by L<GD>'s documentation. Valid quality ranges are 0-100 for
C<jpeg> and 0-9 for C<png>. Completely optional, and defaults to a
( run in 0.930 second using v1.01-cache-2.11-cpan-39bf76dae61 )