Graph avec plusieurs courbes - GD
Bonjour,
J'ai enfin réussi à installer mon module GD sous Solaris.;):P
Je souhaiterais créer un graphe possédant plusieurs courbes. Je suppose (et espère) que c'est possible.
Voilà le code que j'ai mis pour l'instant :
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| my $graph = GD::Graph::lines->new(400, 300);
$graph->set_title_font('/fonts/verdana.ttf', 18);
my $nb = 10;
#my $gd;
$graph->set(labelclr => lred);
$graph->set(
x_label => $datas->{XLABEL},
y_label => $datas->{YLABEL},
title => $titleGraph,
y_max_value => 8,
y_tick_number => 10,
y_label_skip => 0
) or die $graph->error;
for ($i=0;$i<$nbProf;$i++){
for ($m=0;$m<$#{$datas->{XXXX_CORRECTED}[$i]};$m++){
$donnees[0][$m] = $datas->{XXXX_CORRECTED}[$m];
$donnees[1][$m] = -$datas->{PRES_CORRECTED}[$m];
}
my $gd = $graph->plot(\@donnees) or die $graph->error;
}
}
$essai = ">".$pathFileName;
print "nom fichier : $essai\n";
open(IMG, $essai) or die $!;
binmode IMG;
print IMG $gd->png;
close IMG |
Mais, mon programme plante à la ligne :
Code:
print IMG $gd->png;
Il me dit :
Citation:
Can't call method "png" on an undefined value at CoMtlFloatsGraphs_GenerateOverlayedGraph.pl line 139.
Est-ce que quelqu'un sait comment on peut générer plusieurs courbes sur un même graphe?
Merci beaucoup d'avance!;)