1package Template::Plugin::GD::Graph::bars3d; 2 3use strict; 4use warnings; 5use base qw( GD::Graph::bars3d Template::Plugin ); 6 7our $VERSION = sprintf("%d.%02d", q$Revision: 1.58 $ =~ /(\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 21 22sub set_legend { 23 my $self = shift; 24 $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_); 25} 26 271; 28 29__END__ 30 31=head1 NAME 32 33Template::Plugin::GD::Graph::bars3d - Create 3D bar graphs with axes and legends 34 35=head1 SYNOPSIS 36 37 [% USE g = GD.Graph.bars3d(x_size, y_size); %] 38 39=head1 EXAMPLES 40 41 [% FILTER null; 42 data = [ 43 ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", 44 "Sep", "Oct", "Nov", "Dec", ], 45 [-5, -4, -3, -3, -1, 0, 2, 1, 3, 4, 6, 7], 46 [4, 3, 5, 6, 3,1.5, -1, -3, -4, -6, -7, -8], 47 [1, 2, 2, 3, 4, 3, 1, -1, 0, 2, 3, 2], 48 ]; 49 50 USE my_graph = GD.Graph.bars3d(); 51 52 my_graph.set( 53 x_label => 'Month', 54 y_label => 'Measure of success', 55 title => 'A 3d Bar Chart', 56 57 y_max_value => 8, 58 y_min_value => -8, 59 y_tick_number => 16, 60 y_label_skip => 2, 61 box_axis => 0, 62 line_width => 3, 63 zero_axis_only => 1, 64 x_label_position => 1, 65 y_label_position => 1, 66 67 x_label_skip => 3, 68 x_tick_offset => 2, 69 70 transparent => 0, 71 ); 72 my_graph.set_legend("Us", "Them", "Others"); 73 my_graph.plot(data).png | stdout(1); 74 END; 75 -%] 76 77=head1 DESCRIPTION 78 79The GD.Graph.bars3d plugin provides an interface to the GD::Graph::bars3d 80class defined by the GD::Graph3d module. It allows one or more (x,y) data 81sets to be plotted as y versus x bars with a 3-dimensional appearance, 82together with axes and legends. 83 84See L<GD::Graph3d> for more details. 85 86=head1 AUTHOR 87 88Thomas Boutell wrote the GD graphics library. 89 90Lincoln D. Stein wrote the Perl GD modules that interface to it. 91 92Martien Verbruggen wrote the GD::Graph module. 93 94Craig Barratt E<lt>craig@arraycomm.comE<gt> wrote the original GD 95plugins for the Template Toolkit (2001). 96 97Andy Wardley E<lt>abw@cpan.orgE<gt> extracted them from the TT core 98into a separate distribution for TT version 2.15. 99 100=head1 COPYRIGHT 101 102Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt>, 1032006 Andy Wardley E<lt>abw@cpan.orgE<gt>. 104 105GD::Graph3d is copyright (C) 1999,2000 Wadsack-Allen. All Rights Reserved. 106 107This module is free software; you can redistribute it and/or 108modify it under the same terms as Perl itself. 109 110=head1 SEE ALSO 111 112L<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::points>, L<Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d>, L<GD> 113 114=cut 115 116# Local Variables: 117# mode: perl 118# perl-indent-level: 4 119# indent-tabs-mode: nil 120# End: 121# 122# vim: expandtab shiftwidth=4: 123