home *** CD-ROM | disk | FTP | other *** search
/ PC Professionell 2004 December / PCpro_2004_12.ISO / files / webserver / tsw / TSW_3.4.0.exe / Apache2 / perl / mixed.pm < prev    next >
Encoding:
Perl POD Document  |  2004-01-30  |  5.1 KB  |  177 lines

  1. #============================================================= -*-Perl-*-
  2. #
  3. # Template::Plugin::GD::Graph::mixed
  4. #
  5. # DESCRIPTION
  6. #
  7. #   Simple Template Toolkit plugin interfacing to the GD::Graph::mixed
  8. #   package in the GD::Graph.pm module.
  9. #
  10. # AUTHOR
  11. #   Craig Barratt   <craig@arraycomm.com>
  12. #
  13. # COPYRIGHT
  14. #   Copyright (C) 2001 Craig Barratt.  All Rights Reserved.
  15. #
  16. #   This module is free software; you can redistribute it and/or
  17. #   modify it under the same terms as Perl itself.
  18. #
  19. #----------------------------------------------------------------------------
  20. #
  21. # $Id: mixed.pm,v 1.57 2004/01/13 16:20:56 abw Exp $
  22. #
  23. #============================================================================
  24.  
  25. package Template::Plugin::GD::Graph::mixed;
  26.  
  27. require 5.004;
  28.  
  29. use strict;
  30. use GD::Graph::mixed;
  31. use Template::Plugin;
  32. use base qw( GD::Graph::mixed Template::Plugin );
  33. use vars qw( $VERSION );
  34.  
  35. $VERSION = sprintf("%d.%02d", q$Revision: 1.57 $ =~ /(\d+)\.(\d+)/);
  36.  
  37. sub new
  38. {
  39.     my $class   = shift;
  40.     my $context = shift;
  41.     return $class->SUPER::new(@_);
  42. }
  43.  
  44. sub set
  45. {
  46.     my $self = shift;
  47.  
  48.     push(@_, %{pop(@_)}) if ( @_ & 1 && ref($_[@_-1]) eq "HASH" );
  49.     $self->SUPER::set(@_);
  50. }
  51.  
  52.  
  53. sub set_legend
  54. {
  55.     my $self = shift;
  56.     
  57.     $self->SUPER::set_legend(ref $_[0] ? @{$_[0]} : @_);
  58. }
  59.  
  60. 1;
  61.  
  62. __END__
  63.  
  64.  
  65. #------------------------------------------------------------------------
  66. # IMPORTANT NOTE
  67. #   This documentation is generated automatically from source
  68. #   templates.  Any changes you make here may be lost.
  69. #   The 'docsrc' documentation source bundle is available for download
  70. #   from http://www.template-toolkit.org/docs.html and contains all
  71. #   the source templates, XML files, scripts, etc., from which the
  72. #   documentation for the Template Toolkit is built.
  73. #------------------------------------------------------------------------
  74.  
  75. =head1 NAME
  76.  
  77. Template::Plugin::GD::Graph::mixed - Create mixed graphs with axes and legends
  78.  
  79. =head1 SYNOPSIS
  80.  
  81.     [% USE g = GD.Graph.mixed(x_size, y_size); %]
  82.  
  83. =head1 EXAMPLES
  84.  
  85.     [% FILTER null;
  86.         data = [
  87.             ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"],
  88.             [    1,    2,    5,    6,    3,  1.5,   -1,    -3,    -4],
  89.             [   -4,   -3,    1,    1,   -3, -1.5,   -2,    -1,     0],
  90.             [    9,    8,    9,  8.4,  7.1,  7.5,    8,     3,    -3],
  91.             [  0.1,  0.2,  0.5,  0.4,  0.3,  0.5,  0.1,     0,   0.4],
  92.             [ -0.1,    2,    5,    4,   -3,  2.5,  3.2,     4,    -4],
  93.         ];  
  94.             
  95.         USE my_graph = GD.Graph.mixed();
  96.         
  97.         my_graph.set(
  98.             types => ['lines', 'lines', 'points', 'area', 'linespoints'],
  99.             default_type => 'points',
  100.         );  
  101.         
  102.         my_graph.set(
  103.        
  104.             x_label         => 'X Label',
  105.             y_label         => 'Y label',
  106.             title           => 'A Mixed Type Graph',
  107.  
  108.             y_max_value     => 10, 
  109.             y_min_value     => -5,
  110.             y_tick_number   => 3,
  111.             y_label_skip    => 0,
  112.             x_plot_values   => 0,
  113.             y_plot_values   => 0,
  114.                 
  115.             long_ticks      => 1, 
  116.             x_ticks         => 0,  
  117.                 
  118.             legend_marker_width => 24,
  119.             line_width      => 3,
  120.             marker_size     => 5,
  121.  
  122.             bar_spacing     => 8,
  123.  
  124.             transparent     => 0,
  125.         );
  126.          
  127.         my_graph.set_legend('one', 'two', 'three', 'four', 'five', 'six');
  128.         my_graph.plot(data).png | stdout(1);
  129.        END;
  130.     -%]
  131.  
  132. =head1 DESCRIPTION
  133.  
  134. The GD.Graph.mixed plugin provides an interface to the GD::Graph::mixed
  135. class defined by the GD::Graph module. It allows one or more (x,y) data
  136. sets to be plotted with various styles (lines, points, bars, areas etc).
  137.  
  138. See L<GD::Graph> for more details.
  139.  
  140. =head1 AUTHOR
  141.  
  142. Craig Barratt E<lt>craig@arraycomm.comE<gt>
  143.  
  144.  
  145. The GD::Graph module was written by Martien Verbruggen.
  146.  
  147.  
  148. =head1 VERSION
  149.  
  150. 1.57, distributed as part of the
  151. Template Toolkit version 2.13, released on 30 January 2004.
  152.  
  153. =head1 COPYRIGHT
  154.  
  155.  
  156. Copyright (C) 2001 Craig Barratt E<lt>craig@arraycomm.comE<gt>
  157.  
  158. GD::Graph is copyright 1999 Martien Verbruggen.
  159.  
  160. This module is free software; you can redistribute it and/or
  161. modify it under the same terms as Perl itself.
  162.  
  163. =head1 SEE ALSO
  164.  
  165. 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>
  166.  
  167. =cut
  168.  
  169. # Local Variables:
  170. # mode: perl
  171. # perl-indent-level: 4
  172. # indent-tabs-mode: nil
  173. # End:
  174. #
  175. # vim: expandtab shiftwidth=4:
  176.