jifty::plugin::chart::renderer(3pm) [debian man page]
Jifty::Plugin::Chart::Renderer(3pm) User Contributed Perl Documentation Jifty::Plugin::Chart::Renderer(3pm)NAME
Jifty::Plugin::Chart::Renderer - Base class for chart rendering classes
SYNOPSIS
In your config.yml:
Plugins:
- Chart:
DefaultRenderer: MyApp::Renderer
In lib/MyApp/Renderer.pm:
package MyApp::Renderer;
use base qw/ Jifty::Plugin::Chart::Renderer /;
sub init {
my $self = shift;
# Handle any required initialization, like required CSS, JS, etc.
}
sub render {
my $self = shift;
my %args = @_;
# Output your chart
Jifty->web->out( #{ Output your chart here... } );
# You could also return it as a string...
return;
}
METHODS
Your renderer implementation must subclass this package and implement the following methods:
new
This is the constructor. Don't override this directly. Instead implement "init".
init
$renderer->init();
This is called by "new" immediately after constructing the object. It is passed a param hash from the config file. Subclasses should
implement this method to do any required initialization such as letting Jifty know about required CSS files, JS files, etc.
render
Jifty->web->out($renderer->render(%args));
See Jifty::Plugin::Chart::Web for the arguments. It must (at least) accept the arguments given to the "chart" in Jifty::Plugin::Chart::Web
method.
The "render" method may either return it's output or print it out using Jifty::Web::out.
SEE ALSO
Jifty::Plugin::Chart::Web, Jifty::Plugin::Chart::Renderer::Chart
AUTHOR
Andrew Sterling Hanenkamp "<andrew.hanenkamp@boomer.com>"
COPYRIGHT AND LICENSE
Copyright 2007 Boomer Consulting, Inc.
This is free software and may be modified and distributed under the same terms as Perl itself.
perl v5.12.4 2009-03-09 Jifty::Plugin::Chart::Renderer(3pm)
Check Out this Related Man Page
Jifty::Plugin::Chart::Web(3pm) User Contributed Perl Documentation Jifty::Plugin::Chart::Web(3pm)NAME
Jifty::Plugin::Chart::Web - Base class to add to Jifty::Web's ISA
DESCRIPTION
When the Jifty::Plugin::Chart is loaded, this class is added as a base class for Jifty::Web to add the "chart" method to that class.
METHODS
chart
Jifty->web->out(Jifty->web->chart(%args));
The arguments passed in %args may include:
type
This will be one of the following scalar values indicating the kind of chart. A given renderer may not support every type listed here.
A renderer might support others in addition to these, but if it supports these it should use these names.
points
This is the default value. A scatter plot with each dataset represented using differnet dot styles.
lines
A line plot with each dataset presented as separate line.
bars
A bar chart with each dataset set side-by-side.
stackedbars
A bar chart with each dataset stacked on top of each other.
pie A pie chart with a single dataset representing the values for different pieces of the pie.
horizontalbars
A bar chart turned sideways.
area
An area chart uses lines to represent each dataset, but the lines are stacked on top of each other with filled areas underneath.
width
This is the width the chart should take when rendered. This may be a number, indicating the width in pixels. It may also be any value
that would be appropriate for the "width" CSS property.
Defaults to "undef", which indicates that the chart will take on whatever size the box it is in will be. See "CSS FOR CHARTS".
height
This is the height the chart should take when rendered. This may be a number, indicating the height in pixels. It may also be any value
that would be appropriate for the "height" CSS property.
Defaults to "undef", which indicates that the chart will take on whatever size the box it is in will be. See "CSS FOR CHARTS".
data
An array of arrays containing the data. The first array in the parent array is a list of labels. Each following array is the set of
data points matching each label in the first array.
Defaults to no data (i.e., it must be given if anything useful is to happen).
class
This allows you to associated an additional class or classes to the element containing the chart. This can be a string containing on or
more class names separated by spaces or an array of class names.
renderer
This allows you to use a different renderer than the one configured in config.yml. Give the renderer as a class name, which will be
initialized for you.
options
This is a hash containing additional options to pass to the renderer and are renderer specific. This may include anything that is not
otherwise set by one of the other options above.
Here's an example:
<% Jifty->web->chart(
type => 'Pie',
width => '100%',
height => '300px',
data => sub {
[
[ 2004, 2005, 2006, 2007 ],
[ 26, 37, 12, 42 ]
];
},
class => 'visualizeronimicon',
) %>
Be sure to output anything returned by the method (unless it returns undef).
CSS FOR CHARTS
The chart API allows you to build the charts without explicit pixel widths and heights. In fact, you can not specify "width" and "height"
and perform the styling in your regular CSS stylesheets by using the "chart" class associated with every chart or by using custom classes
with the "class" argument.
See your renderer class documentation for further details.
JAVASCRIPT FOR CHARTS
Charts typically require JavaScript to render properly. If the client does not have JavaScript available, the chart may not work or could
look very bad.
If you are using one of the image based renderers like Jifty::Plugin::Chart::Renderer::Chart, it is recommended that you stick with pixel
widths if you expect clients with limited or no JavaScript support.
SEE ALSO
Jifty::Plugin::Chart, Jifty::Plugin::Chart::Renderer
AUTHOR
Andrew Sterling Hanenkamp "<andrew.hanenkamp@boomer.com>"
COPYRIGHT AND LICENSE
Copyright 2007 Boomer Consulting, Inc.
This is free software and may be modified and distributed under the same terms as Perl itself.
perl v5.12.4 2009-03-09 Jifty::Plugin::Chart::Web(3pm)