hi Simon, Can i use GD::Graph::3D-bars; instead of one dimension bar ? Pls advise.
Jason Nah -----Original Message----- From: Simon Oliver [mailto:[EMAIL PROTECTED]] Sent: Monday, September 24, 2001 11:41 PM To: [EMAIL PROTECTED]; [EMAIL PROTECTED] Subject: Re: Perl and Chart I noticed that some browsers do not like the image/x-png mime type so I changed it to image/png - if you want to be sure that most browsers can view the image choose jpeg with a quality of 100 instead: #!perl use warnings; use strict; use DBI; use GD::Graph::bars; my ($driver, $dsn, $uid, $pwd, $attr, $dbh, $sql, $sth); $driver = 'ODBC'; $dsn = 'Orders'; $uid = ''; $pwd = ''; $attr = { RaiseError => 1 }; eval { $sql = 'SELECT Employees.LastName, Count(Orders.OrderID) AS CountOfOrderID FROM Employees INNER JOIN Orders ON Employees.EmployeeID = Orders.EmployeeID GROUP BY Employees.LastName'; $dbh = DBI->connect("dbi:$driver:$dsn", $uid, $pwd, $attr); $sth = $dbh->prepare($sql); $sth->execute(); my (@names, @counts); while (my $row = $sth->fetch) { push @names, $row->[0]; push @counts, $row->[1]; } $sth->finish(); $dbh->disconnect(); my $graph = GD::Graph::bars->new(400, 400); aph->set( title => 'Sales by Employee', x_label => 'Employees', x_label_position => 1/2, x_labels_vertical => 1, y_label => 'Sales', y_label_position => 1/2, bar_spacing => 4, dclrs => [ qw(red green) ], cycle_clrs => 1, ); my $gd = $graph->plot( [\@names, \@counts]); binmode STDOUT; print "Content-type: image/jpeg\n\n"; print $gd->jpeg(100); #print "Content-type: image/png\n\n"; #print $gd->png(); }; if ($@) { print "Content-type: text/html\n\n"; print '<H4>', HTML_encode($@), '</H4>'; exit; } # HTML encode a string sub HTML_encode { my $toencode = shift; return undef unless defined($toencode); $toencode=~s/&/&/g; $toencode=~s/\"/"/g; $toencode=~s/>/>/g; $toencode=~s/</</g; return $toencode; } _______________________________________________ Perl-Win32-Web mailing list [EMAIL PROTECTED] http://listserv.ActiveState.com/mailman/listinfo/perl-win32-web