Chart::ThreeD::Pie

  • Simple pie chart

use Chart::ThreeD::Pie;

# create a new pie
my $pie = new Chart::ThreeD::Pie (400, 300, "A graph");

# add data
$pie->add (1, '#FFAA00', '1st');
$pie->add (2, '#00FF66', '2nd');
$pie->add (3, '#AA00FF', '3rd');
$pie->add (4, '#0000FF', '4th');

$pie->percents (1); # use percentage
$pie->thickness (30);   # thickness of the pie
$pie->want_sort (1);    # sort the "parts"
$pie->border (1);   # add a border

# foreground and background colors
$pie->fgcolor ('#000000');
$pie->bgcolor ('#FFFFFF');

open(IMG, '>file.gif') or die $!;
binmode IMG;
print IMG $pie->plot->gif;
close IMG;