I see two behaviors that are undesirable. If I uncomment the dclrs line in the first set() command, sometimes the whole graph will fail claiming 'Illegal modulus zero in line 443 of GD.pm'. I've tried setting GD::Image to truecolor status, changing my colors to websafe, etc., but as soon as I try setting that palette myself, it bombs erratically. Often, a simple refresh will clear it, too.use GD; use GD::Graph::linespoints; use GD::Graph::bars3d; @colors = ('red', 'green', 'blue', 'gold', 'magenta'); @colorvals = ([255,0,0], [0,204,0],[0,0,255],[255,204,0],[255,0,255] +); . . . $linechart = GD::Graph::linespoints->new(640, 640) or die "no char +t!\n"; $linechart->set( # dclrs => [@colors], line_width => 3, x_label => 'Domain of ' . uc($fdat{domain}) . 's', y_label => 'Mean Value in ' . $ulong, title => "Test: '" . $fdat{testn} . "' Compared by +" . uc($fdat{compare}), x_labels_vertical => 1) or die $linechart->error; $linechart->set_x_axis_font(gdSmallFont); $linechart->set_y_axis_font(gdSmallFont); $gd = $linechart->plot(\@gdata) or die $linechart->error; . . . $legend = new GD::Image($gdwidth,$gdheight); $legend->transparent($legend->colorAllocate(255,255,255)); $legend->rectangle(0,0,$gdwidth-1,$gdheight-1,$legend->colorAlloca +te(0,0,0)); for ($cn=0;$cn<@comps;$cn++) { . . . $thiscolor = $legend->colorAllocate($colorvals[$cn][0],$colorval +s[$cn][1],$colorvals[$cn][2]); $legend->string(gdSmallFont,2,5+($cn*18),$rowdata,$thiscolor); }
In reply to GD and colors by samizdat
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |