-----Original Message-----
>From: "Brown, Rodrick" <[EMAIL PROTECTED]>
>Sent: May 10, 2007 2:09 AM
>To: beginners@perl.org
>Subject: Charting Module
>
>
>I have a few data points I would like to graph not sure the best way to
>go about this with Perl. A basic search on cpan points me to GD and
>WriteExcel anyone using perl for charting/graphing with moderate
>success? 
>

Hello,

As everyone suggested here,using GD::Graph is good enough for creating that 
chart.
Here are the codes I once wrote for creating the bars,wish it's a reference for 
you.

package graph;
use strict;
use GD::Graph::bars;
use CGI;

sub newImage
{
    my ($class,$data,$length,$width,$max_y_value) = @_;

    my $graph = GD::Graph::bars->new($length, $width);
    $graph->set( 
      x_label           => 'CLOCK',
      y_label           => 'PV',
      title             => ' ',
      bar_spacing       => 12,
      show_values       => 1,
#      values_vertical   => 1,
      y_max_value       => $max_y_value,
      box_axis          => 0,
    ) or die $graph->error;

    my $gd = $graph->plot($data) or die $graph->error;

    print CGI->header("image/png");
    binmode STDOUT;
    print $gd->png;

}

1;

And calling it with this like way,

use graph;
my @out = ([xx,xx,xx,xx],[xx,xx,xx,xx],...); # datas to fill
graph->newImage([EMAIL PROTECTED],'755','205',$max_y_value);

--
mailto:[EMAIL PROTECTED]
http://home.arcor.de/jeffpang/

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to