diff options
Diffstat (limited to 'lib/Template/Plugin/GD/Graph')
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/area.pm | 148 | ||||
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/bars.pm | 191 | ||||
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/bars3d.pm | 166 | ||||
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/lines.pm | 178 | ||||
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/lines3d.pm | 166 | ||||
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/linespoints.pm | 158 | ||||
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/mixed.pm | 176 | ||||
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/pie.pm | 141 | ||||
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/pie3d.pm | 145 | ||||
| -rw-r--r-- | lib/Template/Plugin/GD/Graph/points.pm | 155 |
10 files changed, 1624 insertions, 0 deletions
diff --git a/lib/Template/Plugin/GD/Graph/area.pm b/lib/Template/Plugin/GD/Graph/area.pm new file mode 100644 index 0000000..d09d024 --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/area.pm @@ -0,0 +1,148 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::area +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::area +# package in the GD::Graph.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: area.pm,v 1.57 2004/01/13 16:20:51 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::area; + +require 5.004; + +use strict; +use GD::Graph::area; +use Template::Plugin; +use base qw( GD::Graph::area Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + + +sub set_legend +{ + my $self = shift; + + $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::area - Create area graphs with axes and legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.area(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + data = [ + ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], + [ 5, 12, 24, 33, 19, 8, 6, 15, 21], + [ -1, -2, -5, -6, -3, 1.5, 1, 1.3, 2] + ]; + + USE my_graph = GD.Graph.area(); + my_graph.set( + two_axes => 1, + zero_axis => 1, + transparent => 0, + ); + my_graph.set_legend('left axis', 'right axis' ); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.area plugin provides an interface to the GD::Graph::area +class defined by the GD::Graph module. It allows one or more (x,y) data +sets to be plotted as lines with the area between the line and x-axis +shaded, in addition to axes and legends. + +See L<GD::Graph> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph module was written by Martien Verbruggen. + + +=head1 VERSION + +1.57, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph is copyright 1999 Martien Verbruggen. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines|Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::lines3d|Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars|Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d|Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points|Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints|Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::mixed|Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie|Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d|Template::Plugin::GD::Graph::pie3d>, L<GD::Graph|GD::Graph> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: diff --git a/lib/Template/Plugin/GD/Graph/bars.pm b/lib/Template/Plugin/GD/Graph/bars.pm new file mode 100644 index 0000000..9bc08c5 --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/bars.pm @@ -0,0 +1,191 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::bars +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::bars +# package in the GD::Graph.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: bars.pm,v 1.57 2004/01/13 16:20:56 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::bars; + +require 5.004; + +use strict; +use GD::Graph::bars; +use Template::Plugin; +use base qw( GD::Graph::bars Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + + +sub set_legend +{ + my $self = shift; + + $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::bars - Create bar graphs with axes and legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.bars(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + data = [ + ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], + [ 1, 2, 5, 6, 3, 1.5, 1, 3, 4], + ]; + + USE my_graph = GD.Graph.bars(); + + my_graph.set( + x_label => 'X Label', + y_label => 'Y label', + title => 'A Simple Bar Chart', + y_max_value => 8, + y_tick_number => 8, + y_label_skip => 2, + + # shadows + bar_spacing => 8, + shadow_depth => 4, + shadowclr => 'dred', + + transparent => 0, + ); + my_graph.plot(data).png | stdout(1); + END; + -%] + + [% FILTER null; + data = [ + ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], + [ 5, 12, 24, 33, 19, 8, 6, 15, 21], + [ 1, 2, 5, 6, 3, 1.5, 1, 3, 4], + ]; + + USE my_graph = GD.Graph.bars(); + + my_graph.set( + x_label => 'X Label', + y_label => 'Y label', + title => 'Two data sets', + + # shadows + bar_spacing => 8, + shadow_depth => 4, + shadowclr => 'dred', + + long_ticks => 1, + y_max_value => 40, + y_tick_number => 8, + y_label_skip => 2, + bar_spacing => 3, + + accent_treshold => 200, + + transparent => 0, + ); + my_graph.set_legend( 'Data set 1', 'Data set 2' ); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.bars plugin provides an interface to the GD::Graph::bars +class defined by the GD::Graph module. It allows one or more (x,y) data +sets to be plotted with each point represented by a bar, in addition +to axes and legends. + +See L<GD::Graph> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph module was written by Martien Verbruggen. + + +=head1 VERSION + +1.57, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph is copyright 1999 Martien Verbruggen. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines|Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::lines3d|Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars3d|Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points|Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints|Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area|Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed|Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie|Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d|Template::Plugin::GD::Graph::pie3d>, L<GD::Graph|GD::Graph> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: diff --git a/lib/Template/Plugin/GD/Graph/bars3d.pm b/lib/Template/Plugin/GD/Graph/bars3d.pm new file mode 100644 index 0000000..79a930b --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/bars3d.pm @@ -0,0 +1,166 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::bars3d +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::bars3d +# package in the GD::Graph3D.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: bars3d.pm,v 1.57 2004/01/13 16:20:56 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::bars3d; + +require 5.004; + +use strict; +use GD::Graph::bars3d; +use Template::Plugin; +use base qw( GD::Graph::bars3d Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + + +sub set_legend +{ + my $self = shift; + + $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::bars3d - Create 3D bar graphs with axes and legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.bars3d(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + data = [ + ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", + "Sep", "Oct", "Nov", "Dec", ], + [-5, -4, -3, -3, -1, 0, 2, 1, 3, 4, 6, 7], + [4, 3, 5, 6, 3,1.5, -1, -3, -4, -6, -7, -8], + [1, 2, 2, 3, 4, 3, 1, -1, 0, 2, 3, 2], + ]; + + USE my_graph = GD.Graph.bars3d(); + + my_graph.set( + x_label => 'Month', + y_label => 'Measure of success', + title => 'A 3d Bar Chart', + + y_max_value => 8, + y_min_value => -8, + y_tick_number => 16, + y_label_skip => 2, + box_axis => 0, + line_width => 3, + zero_axis_only => 1, + x_label_position => 1, + y_label_position => 1, + + x_label_skip => 3, + x_tick_offset => 2, + + transparent => 0, + ); + my_graph.set_legend("Us", "Them", "Others"); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.bars3d plugin provides an interface to the GD::Graph::bars3d +class defined by the GD::Graph3d module. It allows one or more (x,y) data +sets to be plotted as y versus x bars with a 3-dimensional appearance, +together with axes and legends. + +See L<GD::Graph3d> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph3d module was written by Jeremy Wadsack. + + +=head1 VERSION + +1.57, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph3d is copyright (C) 1999,2000 Wadsack-Allen. All Rights Reserved. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines|Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::lines3d|Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars|Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::points|Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints|Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area|Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed|Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie|Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d|Template::Plugin::GD::Graph::pie3d>, L<GD::Graph|GD::Graph>, L<GD::Graph3d|GD::Graph3d> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: diff --git a/lib/Template/Plugin/GD/Graph/lines.pm b/lib/Template/Plugin/GD/Graph/lines.pm new file mode 100644 index 0000000..678cc64 --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/lines.pm @@ -0,0 +1,178 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::lines +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::lines +# package in the GD::Graph.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: lines.pm,v 1.57 2004/01/13 16:20:56 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::lines; + +require 5.004; + +use strict; +use GD::Graph::lines; +use Template::Plugin; +use base qw( GD::Graph::lines Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + + +sub set_legend +{ + my $self = shift; + + $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::lines - Create line graphs with axes and legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.lines(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + USE g = GD.Graph.lines(300,200); + x = [1, 2, 3, 4]; + y = [5, 4, 2, 3]; + g.set( + x_label => 'X Label', + y_label => 'Y label', + title => 'Title' + ); + g.plot([x, y]).png | stdout(1); + END; + -%] + + [% FILTER null; + data = [ + ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", + "Sep", "Oct", "Nov", "Dec", ], + [-5, -4, -3, -3, -1, 0, 2, 1, 3, 4, 6, 7], + [4, 3, 5, 6, 3,1.5, -1, -3, -4, -6, -7, -8], + [1, 2, 2, 3, 4, 3, 1, -1, 0, 2, 3, 2], + ]; + + USE my_graph = GD.Graph.lines(); + + my_graph.set( + x_label => 'Month', + y_label => 'Measure of success', + title => 'A Simple Line Graph', + + y_max_value => 8, + y_min_value => -8, + y_tick_number => 16, + y_label_skip => 2, + box_axis => 0, + line_width => 3, + zero_axis_only => 1, + x_label_position => 1, + y_label_position => 1, + + x_label_skip => 3, + x_tick_offset => 2, + + transparent => 0, + ); + my_graph.set_legend("Us", "Them", "Others"); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.lines plugin provides an interface to the GD::Graph::lines +class defined by the GD::Graph module. It allows one or more (x,y) data +sets to be plotted as y versus x lines with axes and legends. + +See L<GD::Graph> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph module was written by Martien Verbruggen. + + +=head1 VERSION + +1.57, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph is copyright 1999 Martien Verbruggen. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines3d|Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars|Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d|Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points|Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints|Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area|Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed|Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie|Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d|Template::Plugin::GD::Graph::pie3d>, L<GD::Graph|GD::Graph> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: diff --git a/lib/Template/Plugin/GD/Graph/lines3d.pm b/lib/Template/Plugin/GD/Graph/lines3d.pm new file mode 100644 index 0000000..1f12715 --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/lines3d.pm @@ -0,0 +1,166 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::lines3d +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::lines3d +# package in the GD::Graph3D.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: lines3d.pm,v 1.57 2004/01/13 16:20:56 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::lines3d; + +require 5.004; + +use strict; +use GD::Graph::lines3d; +use Template::Plugin; +use base qw( GD::Graph::lines3d Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + + +sub set_legend +{ + my $self = shift; + + $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::lines3d - Create 3D line graphs with axes and legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.lines3d(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + data = [ + ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", + "Sep", "Oct", "Nov", "Dec", ], + [-5, -4, -3, -3, -1, 0, 2, 1, 3, 4, 6, 7], + [4, 3, 5, 6, 3,1.5, -1, -3, -4, -6, -7, -8], + [1, 2, 2, 3, 4, 3, 1, -1, 0, 2, 3, 2], + ]; + + USE my_graph = GD.Graph.lines3d(); + + my_graph.set( + x_label => 'Month', + y_label => 'Measure of success', + title => 'A 3d Line Graph', + + y_max_value => 8, + y_min_value => -8, + y_tick_number => 16, + y_label_skip => 2, + box_axis => 0, + line_width => 3, + zero_axis_only => 1, + x_label_position => 1, + y_label_position => 1, + + x_label_skip => 3, + x_tick_offset => 2, + + transparent => 0, + ); + my_graph.set_legend("Us", "Them", "Others"); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.lines3d plugin provides an interface to the GD::Graph::lines3d +class defined by the GD::Graph3d module. It allows one or more (x,y) data +sets to be plotted as y versus x lines with a 3-dimensional appearance, +together with axes and legends. + +See L<GD::Graph3d> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph3d module was written by Jeremy Wadsack. + + +=head1 VERSION + +1.57, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph3d is copyright (C) 1999,2000 Wadsack-Allen. All Rights Reserved. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines|Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::bars|Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d|Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points|Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints|Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area|Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed|Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie|Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d|Template::Plugin::GD::Graph::pie3d>, L<GD::Graph|GD::Graph>, L<GD::Graph3d|GD::Graph3d> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: diff --git a/lib/Template/Plugin/GD/Graph/linespoints.pm b/lib/Template/Plugin/GD/Graph/linespoints.pm new file mode 100644 index 0000000..8dc48d9 --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/linespoints.pm @@ -0,0 +1,158 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::linespoints +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::linespoints +# package in the GD::Graph.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: linespoints.pm,v 1.57 2004/01/13 16:20:56 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::linespoints; + +require 5.004; + +use strict; +use GD::Graph::linespoints; +use Template::Plugin; +use base qw( GD::Graph::linespoints Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + + +sub set_legend +{ + my $self = shift; + + $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::linespoints - Create line/point graphs with axes and legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.linespoints(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + data = [ + ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], + [50, 52, 53, 54, 55, 56, 57, 58, 59], + [60, 61, 61, 63, 68, 66, 65, 61, 58], + [70, 72, 71, 74, 78, 73, 75, 71, 68], + ]; + + USE my_graph = GD.Graph.linespoints; + + my_graph.set( + x_label => 'X Label', + y_label => 'Y label', + title => 'A Lines and Points Graph', + y_max_value => 80, + y_tick_number => 6, + y_label_skip => 2, + y_long_ticks => 1, + x_tick_length => 2, + markers => [ 1, 5 ], + skip_undef => 1, + transparent => 0, + ); + my_graph.set_legend('data set 1', 'data set 2', 'data set 3'); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.linespoints plugin provides an interface to the +GD::Graph::linespoints class defined by the GD::Graph module. It allows +one or more (x,y) data sets to be plotted as y versus x lines, plus +symbols placed at each point, in addition to axes and legends. + +See L<GD::Graph> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph module was written by Martien Verbruggen. + + +=head1 VERSION + +1.57, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph is copyright 1999 Martien Verbruggen. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines|Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::lines3d|Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars|Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d|Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points|Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::area|Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed|Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie|Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d|Template::Plugin::GD::Graph::pie3d>, L<GD::Graph|GD::Graph> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: diff --git a/lib/Template/Plugin/GD/Graph/mixed.pm b/lib/Template/Plugin/GD/Graph/mixed.pm new file mode 100644 index 0000000..10dd533 --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/mixed.pm @@ -0,0 +1,176 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::mixed +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::mixed +# package in the GD::Graph.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: mixed.pm,v 1.57 2004/01/13 16:20:56 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::mixed; + +require 5.004; + +use strict; +use GD::Graph::mixed; +use Template::Plugin; +use base qw( GD::Graph::mixed Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + + +sub set_legend +{ + my $self = shift; + + $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::mixed - Create mixed graphs with axes and legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.mixed(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + data = [ + ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], + [ 1, 2, 5, 6, 3, 1.5, -1, -3, -4], + [ -4, -3, 1, 1, -3, -1.5, -2, -1, 0], + [ 9, 8, 9, 8.4, 7.1, 7.5, 8, 3, -3], + [ 0.1, 0.2, 0.5, 0.4, 0.3, 0.5, 0.1, 0, 0.4], + [ -0.1, 2, 5, 4, -3, 2.5, 3.2, 4, -4], + ]; + + USE my_graph = GD.Graph.mixed(); + + my_graph.set( + types => ['lines', 'lines', 'points', 'area', 'linespoints'], + default_type => 'points', + ); + + my_graph.set( + + x_label => 'X Label', + y_label => 'Y label', + title => 'A Mixed Type Graph', + + y_max_value => 10, + y_min_value => -5, + y_tick_number => 3, + y_label_skip => 0, + x_plot_values => 0, + y_plot_values => 0, + + long_ticks => 1, + x_ticks => 0, + + legend_marker_width => 24, + line_width => 3, + marker_size => 5, + + bar_spacing => 8, + + transparent => 0, + ); + + my_graph.set_legend('one', 'two', 'three', 'four', 'five', 'six'); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.mixed plugin provides an interface to the GD::Graph::mixed +class defined by the GD::Graph module. It allows one or more (x,y) data +sets to be plotted with various styles (lines, points, bars, areas etc). + +See L<GD::Graph> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph module was written by Martien Verbruggen. + + +=head1 VERSION + +1.57, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph is copyright 1999 Martien Verbruggen. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines|Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::lines3d|Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars|Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d|Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points|Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints|Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area|Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::pie|Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d|Template::Plugin::GD::Graph::pie3d>, L<GD::Graph|GD::Graph> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: diff --git a/lib/Template/Plugin/GD/Graph/pie.pm b/lib/Template/Plugin/GD/Graph/pie.pm new file mode 100644 index 0000000..e72e26c --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/pie.pm @@ -0,0 +1,141 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::pie +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::pie +# package in the GD::Graph.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: pie.pm,v 1.55 2004/01/13 16:20:56 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::pie; + +require 5.004; + +use strict; +use GD::Graph::pie; +use Template::Plugin; +use base qw( GD::Graph::pie Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.55 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::pie - Create pie charts with legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.pie(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + data = [ + ["1st","2nd","3rd","4th","5th","6th"], + [ 4, 2, 3, 4, 3, 3.5] + ]; + + USE my_graph = GD.Graph.pie( 250, 200 ); + + my_graph.set( + title => 'A Pie Chart', + label => 'Label', + axislabelclr => 'black', + pie_height => 36, + + transparent => 0, + ); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.pie plugin provides an interface to the GD::Graph::pie +class defined by the GD::Graph module. It allows an (x,y) data set to +be plotted as a pie chart. The x values are typically strings. + +See L<GD::Graph> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph module was written by Martien Verbruggen. + + +=head1 VERSION + +1.55, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph is copyright 1999 Martien Verbruggen. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines|Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::lines3d|Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars|Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d|Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points|Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints|Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area|Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed|Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie3d|Template::Plugin::GD::Graph::pie3d>, L<GD::Graph|GD::Graph> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: diff --git a/lib/Template/Plugin/GD/Graph/pie3d.pm b/lib/Template/Plugin/GD/Graph/pie3d.pm new file mode 100644 index 0000000..5f677e0 --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/pie3d.pm @@ -0,0 +1,145 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::pie3d +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::pie3d +# package in the GD::Graph3D.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: pie3d.pm,v 1.55 2004/01/13 16:20:56 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::pie3d; + +require 5.004; + +use strict; +use GD::Graph::pie3d; +use Template::Plugin; +use base qw( GD::Graph::pie3d Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.55 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::pie3d - Create 3D pie charts with legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.pie3d(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + data = [ + ["1st","2nd","3rd","4th","5th","6th"], + [ 4, 2, 3, 4, 3, 3.5] + ]; + + USE my_graph = GD.Graph.pie3d( 250, 200 ); + + my_graph.set( + title => 'A Pie Chart', + label => 'Label', + axislabelclr => 'black', + pie_height => 36, + + transparent => 0, + ); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.pie3d plugin provides an interface to the GD::Graph::pie3d +class defined by the GD::Graph module. It allows an (x,y) data set to +be plotted as a 3d pie chart. The x values are typically strings. + +Note that GD::Graph::pie already produces a 3d effect, so GD::Graph::pie3d +is just a wrapper around GD::Graph::pie. Similarly, the plugin +GD.Graph.pie3d is effectively the same as the plugin GD.Graph.pie. + +See L<GD::Graph3d> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph3d module was written by Jeremy Wadsack. The GD::Graph module was written by Martien Verbruggen. + + +=head1 VERSION + +1.55, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph3d is copyright (c) 1999,2000 Wadsack-Allen. All Rights Reserved. GD::Graph is copyright 1999 Martien Verbruggen. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines|Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::lines3d|Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars|Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d|Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::points|Template::Plugin::GD::Graph::points>, L<Template::Plugin::GD::Graph::linespoints|Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area|Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed|Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie|Template::Plugin::GD::Graph::pie>, L<GD::Graph|GD::Graph>, L<GD::Graph3d|GD::Graph3d> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: diff --git a/lib/Template/Plugin/GD/Graph/points.pm b/lib/Template/Plugin/GD/Graph/points.pm new file mode 100644 index 0000000..97acf51 --- /dev/null +++ b/lib/Template/Plugin/GD/Graph/points.pm @@ -0,0 +1,155 @@ +#============================================================= -*-Perl-*- +# +# Template::Plugin::GD::Graph::points +# +# DESCRIPTION +# +# Simple Template Toolkit plugin interfacing to the GD::Graph::points +# package in the GD::Graph.pm module. +# +# AUTHOR +# Craig Barratt <craig@arraycomm.com> +# +# COPYRIGHT +# Copyright (C) 2001 Craig Barratt. All Rights Reserved. +# +# This module is free software; you can redistribute it and/or +# modify it under the same terms as Perl itself. +# +#---------------------------------------------------------------------------- +# +# $Id: points.pm,v 1.57 2004/01/13 16:20:56 abw Exp $ +# +#============================================================================ + +package Template::Plugin::GD::Graph::points; + +require 5.004; + +use strict; +use GD::Graph::points; +use Template::Plugin; +use base qw( GD::Graph::points Template::Plugin ); +use vars qw( $VERSION ); + +$VERSION = sprintf("%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/); + +sub new +{ + my $class = shift; + my $context = shift; + return $class->SUPER::new(@_); +} + +sub set +{ + my $self = shift; + + push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" ); + $self->SUPER::set(@_); +} + + +sub set_legend +{ + my $self = shift; + + $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_); +} + +1; + +__END__ + + +#------------------------------------------------------------------------ +# IMPORTANT NOTE +# This documentation is generated automatically from source +# templates. Any changes you make here may be lost. +# +# The 'docsrc' documentation source bundle is available for download +# from http://www.template-toolkit.org/docs.html and contains all +# the source templates, XML files, scripts, etc., from which the +# documentation for the Template Toolkit is built. +#------------------------------------------------------------------------ + +=head1 NAME + +Template::Plugin::GD::Graph::points - Create point graphs with axes and legends + +=head1 SYNOPSIS + + [% USE g = GD.Graph.points(x_size, y_size); %] + +=head1 EXAMPLES + + [% FILTER null; + data = [ + ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"], + [ 5, 12, 24, 33, 19, 8, 6, 15, 21], + [ 1, 2, 5, 6, 3, 1.5, 2, 3, 4], + ]; + USE my_graph = GD.Graph.points(); + my_graph.set( + x_label => 'X Label', + y_label => 'Y label', + title => 'A Points Graph', + y_max_value => 40, + y_tick_number => 8, + y_label_skip => 2, + legend_placement => 'RC', + long_ticks => 1, + marker_size => 6, + markers => [ 1, 7, 5 ], + + transparent => 0, + ); + my_graph.set_legend('one', 'two'); + my_graph.plot(data).png | stdout(1); + END; + -%] + +=head1 DESCRIPTION + +The GD.Graph.points plugin provides an interface to the GD::Graph::points +class defined by the GD::Graph module. It allows one or more (x,y) data +sets to be plotted as points, in addition to axes and legends. + +See L<GD::Graph> for more details. + +=head1 AUTHOR + +Craig Barratt E<lt>craig@arraycomm.comE<gt> + + +The GD::Graph module was written by Martien Verbruggen. + + +=head1 VERSION + +1.57, distributed as part of the +Template Toolkit version 2.13, released on 30 January 2004. + +=head1 COPYRIGHT + + +Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt> + +GD::Graph is copyright 1999 Martien Verbruggen. + +This module is free software; you can redistribute it and/or +modify it under the same terms as Perl itself. + +=head1 SEE ALSO + +L<Template::Plugin|Template::Plugin>, L<Template::Plugin::GD|Template::Plugin::GD>, L<Template::Plugin::GD::Graph::lines|Template::Plugin::GD::Graph::lines>, L<Template::Plugin::GD::Graph::lines3d|Template::Plugin::GD::Graph::lines3d>, L<Template::Plugin::GD::Graph::bars|Template::Plugin::GD::Graph::bars>, L<Template::Plugin::GD::Graph::bars3d|Template::Plugin::GD::Graph::bars3d>, L<Template::Plugin::GD::Graph::linespoints|Template::Plugin::GD::Graph::linespoints>, L<Template::Plugin::GD::Graph::area|Template::Plugin::GD::Graph::area>, L<Template::Plugin::GD::Graph::mixed|Template::Plugin::GD::Graph::mixed>, L<Template::Plugin::GD::Graph::pie|Template::Plugin::GD::Graph::pie>, L<Template::Plugin::GD::Graph::pie3d|Template::Plugin::GD::Graph::pie3d>, L<GD::Graph|GD::Graph> + +=cut + +# Local Variables: +# mode: perl +# perl-indent-level: 4 +# indent-tabs-mode: nil +# End: +# +# vim: expandtab shiftwidth=4: |
