3 use Imager::Graph::Column;
5 use Imager::Font::Test;
9 or mkdir "testout", 0700
10 or die "Could not create output directory: $!";
14 use Imager qw(:handy);
19 local $SIG{__WARN__} =
26 #my $fontfile = 'ImUgly.ttf';
27 #my $font = Imager::Font->new(file=>$fontfile, type => 'ft2', aa=>1)
28 # or plan skip_all => "Cannot create font object: ",Imager->errstr,"\n";
29 my $font = Imager::Font::Test->new();
31 my @data = ( 100, 180, 80, 20, 2, 1, 0.5 );
32 my @labels = qw(alpha beta gamma delta epsilon phi gi);
35 my $column = Imager::Graph::Column->new();
36 ok($column, "creating column chart object");
38 $column->add_data_series(\@data);
39 $column->set_labels(\@labels);
41 my $img1 = $column->draw();
42 ok($img1, "drawing column chart");
44 $img1->write(file=>'testout/t12_column.ppm') or die "Can't save img1: ".$img1->errstr."\n";
48 my $column = Imager::Graph::Column->new();
49 ok($column, "creating column chart object");
51 $column->add_data_series(\@data);
52 $column->add_data_series([ -50, -30, 20, 10, -10, 25, 10 ]);
53 $column->set_labels(\@labels);
55 my $img1 = $column->draw(features => "outline");
56 ok($img1, "drawing column chart");
58 $img1->write(file=>'testout/t12_column2.ppm') or die "Can't save img1: ".$img1->errstr."\n";
62 my $column = Imager::Graph::Column->new();
63 ok($column, "creating column chart object");
65 $column->add_data_series(\@data);
66 $column->add_data_series([ -50, -30, 20, 10, -10, 25, 10 ]);
67 $column->set_labels(\@labels);
69 my $fountain = Imager::Fountain->simple(colors => [ "#C0C0FF", "#E0E0FF" ],
70 positions => [ 0, 1 ]);
75 segments => $fountain,
82 my $img1 = $column->draw
84 features => "outline",
85 negative_bg => \%fill,
87 ok($img1, "drawing column chart - negative_bg is a fill");
89 $img1->write(file=>'testout/t12_column3.ppm') or die "Can't save img1: ".$img1->errstr."\n";
92 unless (is(@warned, 0, "should be no warnings")) {