NAME
Catalyst::View::SVG::TT::Graph - SVG::TT::Graph charts (in svg/png/jpeg.. format) for your Catalyst application
SYNOPSIS
Create your view class:
./script/myapp_create.pl view Chart SVG::TT::Graph
Set your chart preferences in your view:
__PACKAGE__->config( {
format => 'png',
style_sheet => '/path/to/stylesheet.css',
show_graph_title => 1
} );
Stash your chart data in your controller:
$c->stash->{chart_title} = 'Sales data'; # optional
$c->stash->{chart_type} = 'Bar'; # or Pie/Line/BarHorizontal
$c->stash->{chart_conf} = {
height => 400,
width => 600
};
$c->stash->{chart_fields} = [ qw(Jan Feb March ..) ];
$c->stash->{chart_data} = [ 120, 102, ..];
In your end method:
$c->forward($c->view('Chart'));
If you want, say a comparative line graph of mutiple sets of data:
$c->stash->{chart_type} = 'Line';
$c->stash->{chart_data} = [
{ title => 'Barcelona', data => [ ... ] },
{ title => 'Atletico', data => [ ... ] },
];
OPTIONS
format
Can be svg, png or jpeg or any other format supported by Image::LibRSVG
For other options, see SVG::TT::Graph
SEE ALSO
SVG::TT::Graph, Image::LibRSVG
AUTHOR
Terence Monteiro <terencemo[at]cpan.org>
LICENSE
This library is free software. You can redistribute it and/or modify it under the same terms as Perl itself.