Apache-Wyrd

 view release on metacpan or  search on metacpan

Wyrd/Chart.pm  view on Meta::CPAN

use 5.006;
use strict;
use warnings;
no warnings qw(uninitialized);

package Apache::Wyrd::Chart;
our $VERSION = '0.98';
use base qw(Apache::Wyrd::Interfaces::Setter Apache::Wyrd);
use GD::Graph;
use GD::Graph::colour qw(:colours :convert :lists);
use Apache::Wyrd::Services::SAK qw(:tag :file token_parse token_hash);
use Digest::SHA qw(sha1_hex);
use Data::Dumper;

=pod

=head1 NAME

Apache::Wyrd::Chart - Embed Dynamically-redrawn charts in HTML

=head1 SYNOPSIS

  <BASENAME::Chart img="chart.png" type="bars" height="200" width="300">
    <BASENAME::Query>
      select month, price
      from monthly_prices
      order by month
    </BASENAME::Query>
  </BASENAME::Chart>

=head1 DESCRIPTION

Chart-graphic Wyrd wrapping the C<GD::Graph> Module.  Creates a graphic file
(PNG) and a meta-data file based on data handed it to by an
C<Apache::Wyrd::Query> Wyrd.

=head2 HTML ATTRIBUTES

The Chart Wyrd accepts nearly all the attributes of the GD::Graph module and the
E<lt>imgE<gt> tag, producing an E<lt>imgE<gt> tag which points to the
graphic file produced by GD::Graph, having most attributes (such as onClick,
border, but not src) given to the Chart Wyrd.

=over

=item Wyrd attributes:

=over

=item data_col

Which column of the query to plot.  Default: 2.

=item labels

A comma or whitespace-separated list of label names.  If not enough labels
are given, the remainder will be labeled "unknown"

=item label_col

Which column of the query to use for labels.  Default: 1.

=item other_limit

Items with values under this number will be lumped together under the item
name "Other".

=item label_filters, value_filters

A whitespace or comma delineated list of builtin filters to apply to the
labels or values respectively.  Current filters:

=over



( run in 2.581 seconds using v1.01-cache-2.11-cpan-437f7b0c052 )