G::Tools

Graph

Summary Included libraries Package variables Synopsis Description General documentation Methods

Summary
G::Tools::Graph - Perl extension for blah blah blah
Package variables top
Globals (from use vars definitions)
@EXPORT
$VERSION
@EXPORT_OK
Included modulestop
G::Messenger
SubOpt
strict
Inherit top
AutoLoader Exporter
Synopsistop
  use G::Tools::Graph;
blah blah blah
Descriptiontop
Stub documentation for G::Tools::Graph was created by h2xs. It looks like the
author of the extension was negligent enough to leave the stub
unedited.

Blah blah blah.
Methodstop
BEGIN Code
DESTROYNo descriptionCode
_UniMultiGrapherNo descriptionCode
_UniUniGrapherNo descriptionCode
newNo descriptionCode

Methods description


Methods code

BEGINtop
BEGIN {
    eval "use GD::Graph::lines;";
    if($@){ warn "$@" };
    eval "use Chart::Graph qw(gnuplot);";
    if($@){ warn "$@" };
}
DESTROYdescriptiontopprevnext
sub DESTROY {
    my $self = shift;
}
_UniMultiGrapherdescriptiontopprevnext
sub _UniMultiGrapher {
    &opt_default(x=>"x", y=>"y", title=>"graph", 
		   filename=>"graph.png", type=>"columns",
		 style=>"lines", grapher=>"gnuplot");

    mkdir ("graph", 0777);    
    my @args = opt_get(@_);

    if (opt_val("grapher") eq 'gnuplot' && 'MSWin32' ne $^O){
	my $ref_y = shift @args;
	my @command = ({"title" => opt_val("title"),
			    "output file" => 'graph/' . opt_val("filename"),
			    "x-axis label" => opt_val("x"),
			"y-axis label" => opt_val("y")}, );
	my $i = 1;
	foreach my $ref_x (@args){
	    my $title = opt_val("x$i");
	    $title = "x$i" if ($title eq '');
	    
	    push (@command,
		  [{"title" => $title,
		    "style" => opt_val("style"),
		    "type" => opt_val("type")},
		          $ref_y, $ref_x, ]
		  );
	    $i ++;
	}
    
	gnuplot(@command);
    }else{
	my $graph = GD::Graph::lines->new(640, 480);
	my $skip = int(scalar(@{$args[0]}) / 10);
$graph->set( x_label => opt_val("x"), y_label => opt_val("y"), title => opt_val("title"), x_label_skip => $skip, ); my $i = 1; my @legend; while(opt_val("x$i")){ push (@legend, opt_val("x$i")); $i ++; } $graph->set_legend(@legend) if (scalar(@legend)); my $gd = $graph->plot(\@args); open(IMG, '>graph/' . opt_val("filename")) or die $!; binmode IMG; print IMG $gd->png; close(IMG); }
}
_UniUniGrapherdescriptiontopprevnext
sub _UniUniGrapher {
    &opt_default(x=>"x", y=>"y", title=>"graph", 
		 filename=>"graph.gif",
		 style=>"lines", type=>"columns");

    my @args = opt_get(@_);
    my $array_ref1 = shift;
    my $array_ref2 = shift;
    my $title = shift;
    mkdir("graph", 0777);
    gnuplot(
	    {"title" => opt_val("title"),
	     "output file" => 'graph/' . opt_val("filename"),
	     "x-axis label" => opt_val("x"),
	     "y-axis label" => opt_val("y")},

	    [{"title" => opt_val("title"),
	      "style" => opt_val("style"),
	      "type" => opt_val("type")},
	      $array_ref1, $array_ref2, ],
	     );
}
newdescriptiontopprevnext
sub new {
    my $pkg = shift;
    my $filename = shift;
    my $option = shift;
    my $this;

    return $this;
}

General documentation

AUTHOR top
A. U. Thor, a.u.thor@a.galaxy.far.far.away
SEE ALSO top
perl(1).