Jifty::Plugin::Chart::Web - Base class to add to Jifty::Web's ISA
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.
Jifty->web->out(Jifty->web->chart(%args));
The arguments passed in %args may include:
%args
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.
This is the default value. A scatter plot with each dataset represented using differnet dot styles.
A line plot with each dataset presented as separate line.
A bar chart with each dataset set side-by-side.
A bar chart with each dataset stacked on top of each other.
A pie chart with a single dataset representing the values for different pieces of the pie.
A bar chart turned sideways.
An area chart uses lines to represent each dataset, but the lines are stacked on top of each other with filled areas underneath.
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.
width
Defaults to undef, which indicates that the chart will take on whatever size the box it is in will be. See "CSS FOR CHARTS".
undef
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.
height
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).
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.
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.
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).
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.
class
See your renderer class documentation for further details.
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.
Jifty::Plugin::Chart, Jifty::Plugin::Chart::Renderer
Andrew Sterling Hanenkamp <andrew.hanenkamp@boomer.com>
<andrew.hanenkamp@boomer.com>
Copyright 2007 Boomer Consulting, Inc.
This is free software and may be modified and distributed under the same terms as Perl itself.
To install Jifty::Plugin::Chart, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Jifty::Plugin::Chart
CPAN shell
perl -MCPAN -e shell install Jifty::Plugin::Chart
For more information on module installation, please visit the detailed CPAN module installation guide.