http://qs1969.pair.com?node_id=1219241

theravadamonk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perl Monks

I want to have a doughnut chart for Hard Disk. It should display Used space, Free Space and Total etc.. Now, I wrote a code for it. It's a pie chart.. How can I get a doughnut for it. I want to display with CGI.

Here's my code

#!/usr/bin/perl use CGI ':standard'; use strict; use warnings; use GD::Graph::pie; my $cmd_1 = "sudo df -h |grep /var |awk '{print \$2}' | sed -e 's/.\$/ +/'"; my $cmd_2 = "sudo df -h |grep /var |awk '{print \$3}' | sed -e 's/.\$/ +/'"; my $result_used = qx/ $cmd_1 /; #$result_used shows 1.4 my $result_free = qx/ $cmd_2 /; #$result_free shows 85 # Both the arrays should same number of entries. my @data = (['Used', 'Free'], [$result_used, $result_free]); my $mygraph = GD::Graph::pie->new(300, 300); $mygraph->set( title => '/var Partition, Size in GB', '3d' => 0, #'3d' => 1, ) or warn $mygraph->error; $mygraph->set_value_font(GD::gdMediumBoldFont); my $myimage = $mygraph->plot(\@data) or die $mygraph->error; print "Content-type: image/png\n\n"; print $myimage->png;

I think Doughnut chart is NICER. But, I can't find many docs for them.

Can U guys help me? Better methods are also welcome...