3 use Imager::Graph::Pie;
5 use Imager::Font::Test;
10 use Imager qw(:handy);
14 #my $fontfile = 'ImUgly.ttf';
15 #my $font = Imager::Font->new(file=>$fontfile, type => 'ft2', aa=>1)
16 # or plan skip_all => "Cannot create font object: ",Imager->errstr,"\n";
17 my $font = Imager::Font::Test->new();
19 my @data = ( 100, 180, 80, 20, 2, 1, 0.5 );
20 my @labels = qw(alpha beta gamma delta epsilon phi gi);
22 my $api_pie = Imager::Graph::Pie->new();
24 $api_pie->addDataSeries(\@data, 'Demo series');
25 $api_pie->setFont($font);
26 $api_pie->setLabels(\@labels);
27 $api_pie->setGraphSize(50);
28 $api_pie->setImageWidth(200);
29 $api_pie->setImageHeight(200);
30 $api_pie->setTitle('Test 20');
31 $api_pie->setStyle('fount_rad');
33 my $api_img = $api_pie->draw();
36 my $data_pie = Imager::Graph::Pie->new();
38 my $data_img = $data_pie->draw(
42 title => { text => 'Test 20' },
52 my ($api_content, $data_content);
54 $data_img->write(data => \$data_content, type=>'tiff', tiff_compression => 'none') or die "Err: ".$data_img->errstr;
55 $api_img->write(data => \$api_content, type=>'tiff', tiff_compression => 'none') or die "Err: ".$api_img->errstr;
57 ok($data_content eq $api_content);