File Coverage

samples/sample1B.pl
Criterion Covered Total %
statement 4 6 66.6
branch n/a
condition n/a
subroutine 2 2 100.0
pod n/a
total 6 8 75.0


line stmt bran cond sub pod time code
1             #!/usr/bin/perl
2             # This code demonstrates the problem I am having with labels inside
3             # of a stacked bar chart
4              
5 1     1   1521 use strict;
  1         1  
  1         27  
6 1     1   440 use GD::Graph::hbars;
  0            
  0            
7             require "save.pl";
8              
9             my @data = (
10             ["1st","2nd","3rd","4th","5th","6th","7th", "8th", "9th"],
11             [ 1, 2, 5, 6, 3, 1.5, 1, 3, 4],
12             [ 1, 1.5, 3, 2, 3, 1.5, 3, 4, 4 ]
13             );
14              
15             my @dim = (600,400);
16             my @names = qw/sample1B sample1B-h/;
17              
18             for my $graph (GD::Graph::bars->new(@dim),GD::Graph::hbars->new(@dim)) {
19             my $name = shift @names;
20             print STDERR "Processing $name\n";
21              
22             $graph->set_legend('Pass', 'Fail');
23             $graph->set(
24             x_label => 'X Label',
25             y_label => 'Y label',
26             title => 'Cumulated bar graph with labels',
27             y_max_value => 10,
28             y_tick_number => 10,
29             y_label_skip => 2,
30             bar_spacing => 8,
31             cumulate => 'true',
32            
33             dclrs => [ qw( green lred ) ],
34             show_values => 1,
35             values_space => 4,
36             )
37             or warn $graph->error;
38             my $format = $graph->export_format;
39             $graph->plot(\@data)->$format();
40            
41             save_chart($graph,$name);
42             }
43              
44              
45             1;