1package Template::Plugin::GD::Graph::pie;
2
3use strict;
4use warnings;
5use base qw( GD::Graph::pie Template::Plugin );
6
7our $VERSION = sprintf("%d.%02d", q$Revision: 1.56 $ =~ /(\d+)\.(\d+)/);
8
9sub new {
10    my $class   = shift;
11    my $context = shift;
12    return $class->SUPER::new(@_);
13}
14
15sub set {
16    my $self = shift;
17    push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" );
18    $self->SUPER::set(@_);
19}
20
211;
22
23__END__
24
25=head1 NAME
26
27Template::Plugin::GD::Graph::pie - Create pie charts with legends
28
29=head1 SYNOPSIS
30
31    [% USE g = GD.Graph.pie(x_size, y_size); %]
32
33=head1 EXAMPLES
34
35    [% FILTER null;
36        data = [
37            ["1st","2nd","3rd","4th","5th","6th"],
38            [    4,    2,    3,    4,    3,  3.5]
39        ];
40
41        USE my_graph = GD.Graph.pie( 250, 200 );
42
43        my_graph.set(
44                title => 'A Pie Chart',
45                label => 'Label',
46                axislabelclr => 'black',
47                pie_height => 36,
48
49                transparent => 0,
50        );
51        my_graph.plot(data).png | stdout(1);
52       END;
53    -%]
54
55=head1 DESCRIPTION
56
57The GD.Graph.pie plugin provides an interface to the GD::Graph::pie
58class defined by the GD::Graph module. It allows an (x,y) data set to
59be plotted as a pie chart. The x values are typically strings.
60
61See L<GD::Graph> for more details.
62
63=head1 AUTHOR
64
65Thomas Boutell wrote the GD graphics library.
66
67Lincoln D. Stein wrote the Perl GD modules that interface to it.
68
69Martien Verbruggen wrote the GD::Graph module.
70
71Craig Barratt E<lt>craig@arraycomm.comE<gt> wrote the original GD
72plugins for the Template Toolkit (2001).
73
74Andy Wardley E<lt>abw@cpan.orgE<gt> extracted them from the TT core
75into a separate distribution for TT version 2.15.
76
77=head1 COPYRIGHT
78
79Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt>,
802006 Andy Wardley E<lt>abw@cpan.orgE<gt>.
81
82GD::Graph is copyright 1999 Martien Verbruggen.
83
84This module is free software; you can redistribute it and/or
85modify it under the same terms as Perl itself.
86
87=head1 SEE ALSO
88
89L<Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie3d>, L<GD>
90
91=cut
92
93# Local Variables:
94# mode: perl
95# perl-indent-level: 4
96# indent-tabs-mode: nil
97# End:
98#
99# vim: expandtab shiftwidth=4:
100