Catalyst-View-Chart-Strip
view release on metacpan or search on metacpan
NAME
Catalyst::View::Chart::Strip - A Catalyst View for Chart::Strip graphics
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');
}
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->stash".
Instances of Catalyst::View::Chart::Strip, like
"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 Chart::Strip are
supported as "->config" parameters in your View class, and are also
overrideable at chart generation time via "$c->stash->{chart_opts}".
Catalyst::View::Chart::Strip adds a few new options in addition to the
ones that are standard in Chart::Strip, which are detailed below.
CONFIGURATION PARAMETERS
(See Chart::Strip for a complete list of options. Any Chart::Strip
option can be passed through as a "->config" parameter).
All of these options are valid both a "->config" time, or at chart
generation time via "$c->stash->{chart_opts}".
img_type
Sets the output image type. Values currently supported by Chart::Strip
and GD beneath it are "png" and "jpeg". The default is "png" if
unspecified.
quality
This is the quality parameter for the output graphics data, as
documented in detail by GD's documentation. Valid quality ranges are
0-100 for "jpeg" and 0-9 for "png". Completely optional, and defaults to
a reasonably normal value in both cases.
palette
An optional arrayref of colors as six-digit hexidecimal strings, like
"FFFFFF" or "4A5C2D". The various datasets in your graph will be colored
( run in 0.566 second using v1.01-cache-2.11-cpan-39bf76dae61 )