>> You already have the image as a pie so why not just overlay a background-coloured circle on the middle?
This time I used GD::Image to draw a circle and inserted it to the pie chart.
Here's the code. It works...
#!/usr/bin/perl
use CGI ':standard';
use strict;
use warnings;
use GD;
use GD::Graph::pie;
my @df = `df -P /var`;
my ($used, $free) = (split (/\s+/, $df[1]))[2,3];
# Both the arrays should have same number of entries.
my @data = (['Used', 'Free'],
[$used, $free]);
my $mygraph = GD::Graph::pie->new(175, 175);
$mygraph->set(
title => '/var Partition' ,
'3d' => 0,
#'3d' => 1,
#label => 'Label',
transparent => 1,
) or warn $mygraph->error;
$mygraph->set_value_font(GD::gdMediumBoldFont);
my $myimage = $mygraph->plot(\@data) or die $mygraph->error;
my $circleImg = new GD::Image( 100,100 );
# allocate some colors
my $green = $circleImg->colorAllocate(0,255,0);
my $white = $circleImg->colorAllocate(255,255,255);
my $blue = $circleImg->colorAllocate(0,0,255);
#$circleImg->transparent($green);
#$circleImg->interlaced('true');
# Draw a blue circle
$circleImg->arc(50,50,100,100,0,360,$blue);
# And fill it with color
$circleImg->fill(50,50,$white);
$myimage->copy($circleImg,38,46,0,0,100,100);
print "Content-type: image/png\n\n";
binmode STDOUT;
print $myimage->png;
Hv a Nice day to all perl Monks...