NAME

Catalyst::View::SVG::TT::Graph - SVG::TT::Graph charts (in svg/png/gif/jpeg..) for your Catalyst application

SYNOPSIS

Create your view class:

./script/myapp_create.pl view Chart SVG::TT::Graph

Set your chart preferences in your config:

<View::Chart>
    format         png
    <chart_conf>
        style_sheet         /path/to/stylesheet.css
        show_graph_title    1
    </chart_conf>
</View::Chart>

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

Options can be set in the config or in the stash

format

Can be svg, png, gif, jpeg or any other format supported by Image::LibRSVG

chart_conf

All options taken by SVG::TT::Graph can be provided

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.