For Programmers: Free Programming Magazines  


Home > Archive > PERL Miscellaneous > August 2005 > GD::Graph::bars









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author GD::Graph::bars
Alexandre Jaquet

2005-08-25, 6:57 pm

Hi,

I need to print out some text before and after an image,
how can I commbine text + image

right now I use and have try the commented solution but doesn't
work

use GD::Graph::bars;

#print "Content-type: image/html\n\n";
#print "test";
my $img = generate();
print "Content-type: image/jpeg\n\n";
print $img;


sub generate {
my @data = ( ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
"Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
[ 10],
[ 119] );
my $graph = GD::Graph::bars->new(300, 300);
$graph->set( title => "Evaluation vente",
y_label => "Nombre de ventes");
$graph->set_legend( "Négatif (0)",
"Positif (12)");
my $gd = $graph->plot(\@data);
binmode STDOUT;

return $gd->jpeg(100);
}


thanks
Miroslav Suchy

2005-08-27, 9:58 pm

Alexandre Jaquet > wrote:
> Hi,
>
> I need to print out some text before and after an image,
> how can I commbine text + image


perldoc GD
Look for chapter "Character and String Drawing"


Try this:
use GD;
> use GD::Graph::bars;
>
> my $img = generate();
> print "Content-type: image/jpeg\n\n";

binmode STDOUT;
> print $img;
>
>
> sub generate {
> my @data = ( ["Jan", "Feb", "Mar", "Apr", "May", "Jun",
> "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"],
> [ 10],
> [ 119] );
> my $graph = GD::Graph::bars->new(300, 300);
> $graph->set( title => "Evaluation vente",
> y_label => "Nombre de ventes");
> $graph->set_legend( "Négatif (0)",
> "Positif (12)");
> my $gd = $graph->plot(\@data);

$gd->string(gdSmallFont,2,10,"test",$peach);
>
> return $gd->jpeg(100);
> }



Miroslav Suchy
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com