Graph/Bar.pm

filter: Statementstmt 100% 12 / 12 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod n/a totaltotal 100% 16 / 16 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Graph/Area.pm ↑ Summary Graph/Column.pm »
1 package Imager::Graph::Bar;
2  
3 =head1 NAME
4  
5 Imager::Graph::Bar - a tool for drawing bar charts on Imager images
6  
7 =head1 SYNOPSIS
8  
9 use Imager::Graph::Bar;
10 use Imager::Font;
11  
12 my $font = Imager::Font->new(file => '/path/to/font.ttf') || die "Error: $!";
13  
14 my $graph = Imager::Graph::Bar->new();
15 $graph->set_image_width(900);
16 $graph->set_image_height(600);
17 $graph->set_font($font);
18 $graph->use_automatic_axis();
19 $graph->show_legend();
20  
21 my @data = (1, 2, 3, 5, 7, 11);
22 my @labels = qw(one two three five seven eleven);
23  
24 $graph->add_data_series(\@data, 'Primes');
25 $graph->set_labels(\@labels);
26  
27 my $img = $graph->draw() || die $graph->error;
28  
29 $img->write(file => 'bars.png');
30  
31  
32  
33 =cut
34  
35 4 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
36 4 ▶use vars qw(@ISA);
Subroutine BEGIN: called CC=1 SCAR=0.0
37 4 ▶use Imager::Graph::Horizontal;
Subroutine BEGIN: called CC=1 SCAR=0.0
38 4 @ISA = qw(Imager::Graph::Horizontal);
39  
40 sub _get_default_series_type {
41 4 ▶ return 'bar';
Subroutine _get_default_series_type: called CC=1 SCAR=0.0
42 }
43  
44 4 1;
45  
« Graph/Area.pm ↑ Summary Graph/Column.pm »