Branch Coverage

blib/lib/Chart/Base.pm
Criterion Covered Total %
branch 277 454 61.0


line true false branch
74 0 185 unless ($#_ % 2)
87 38 618 if ($_ =~ /^colors$/)
90 2 157 if ($key =~ /^grid_lines$/)
110 0 0 if ($$self{'dataref'} and $#{$$self{'dataref'};} != $#data)
131 0 216 if ($$self{'dataref'} and $#{$$self{'dataref'}[0];} != $#data)
151 0 0 if (ref \$filename eq 'SCALAR') { }
0 0 elsif (ref(\$filename) =~ /^(?:REF|GLOB)$/) { }
153 0 0 unless open $File, $filename
167 0 0 if (@array != ())
168 0 0 if ($format =~ /^pt$/i) { }
0 0 elsif ($format =~ /^set$/i) { }
225 58 2 if (ref \$file eq 'SCALAR') { }
2 0 elsif (ref(\$file) =~ /^(?:REF|GLOB)$/) { }
228 58 0 if (-f $file)
230 0 58 if ($number_deleted_files != 1)
235 0 58 if (not defined $fh)
293 0 0 if ($$self{'no_cache'} =~ /^true$/i) { }
342 0 0 if (ref \$file eq 'SCALAR') { }
0 0 elsif (ref(\$file) =~ /^(?:REF|GLOB)$/) { }
347 0 0 if (-f $file)
349 0 0 if ($number_deleted_files != 1)
354 0 0 if (not defined $fh)
410 0 0 if ($$self{'no_cache'} =~ /^true$/i) { }
477 0 1 unless ($$self{'imagemap'} =~ /^true$/i and $$self{'imagemap_data'})
713 56 20 if ($$self{'dataref'}) { }
743 0 66 unless (scalar @{$$self{'dataref'};} >= 2)
749 0 66 if ($$self{'y_ticks'} <= 1)
760 66 164 if (scalar @{$$self{'dataref'}[$_];} > $$self{'num_datapoints'})
773 9 30676 if not defined $_
774 117 30559 if (length $$self{'f_x_tick'}($_) > $length)
778 0 66 if ($length <= 0)
785 4 62 if ($$self{'xy_plot'} =~ /^true$/i and $self->isa('Chart::Lines') || $self->isa('Chart::Points') || $self->isa('Chart::LinesPoints') || $self->isa('Chart::Split') || $self->isa('Chart::ErrorBars'))
815 58 2 if $$self{'title'}
818 8 52 if $$self{'sub_title'}
822 1 59 if $$self{'sort'} =~ /^true$/i
989 4 56 if ($$self{'transparent'} =~ /^true$/i)
1082 568 9863 unless (defined $index)
1094 392 176 unless (defined $index)
1104 0 10431 wantarray && @_ > 1 ? :
1112 88 480 if (ref $spec eq 'ARRAY') { }
480 0 elsif (not ref $spec) { }
1114 0 88 unless @rgb == 3 and grep((!/^\d+$/ || $_ > 255), @rgb) == 0
1118 0 480 unless $named_colors{$spec}
1137 7 52 if (defined $$self{'colors'}{'title'}) { }
1144 0 59 unless (ref $font eq 'GD::Font')
1186 0 8 unless (ref $font eq 'GD::Font')
1242 0 1165 if (not $data[$i][$j] =~ /^[+-]?((\.\d+)|(\d+\.?\d*))([eE][+-]?\d+)?[fFdD]?$/)
1252 1 3 if ($$self{'include_zero'} =~ /^true$/i)
1253 1 0 if ($d_min * $d_max > 0)
1254 1 0 if ($d_min > 0) { }
1268 0 4 if (0 == $d_width)
1296 31 0 if (defined $$self{'f_y_tick'}) { }
1298 31 0 if ($$self{'f_y_tick'} == \&_default_f_tick) { }
1310 6 25 if $maxtickLabelLen < length $labelText
1356 14 47 if ($$self{'include_zero'} =~ /^true$/i)
1358 8 6 if ($d_min * $d_max > 0)
1360 8 0 if ($d_min > 0) { }
1371 0 61 if ($$self{'integer_ticks_only'} =~ /^\d$/)
1372 0 0 if ($$self{'integer_ticks_only'} == 1) { }
1378 10 51 if ($$self{'integer_ticks_only'} =~ /^true$/i) { }
1383 6 4 if $f_min
1386 8 2 if $f_max
1389 0 10 if ($d_min > $d_max)
1399 0 10 if $skip < 1
1415 91 0 if (defined $$self{'f_y_tick'}) { }
1418 82 9 if ($$self{'f_y_tick'} == \&_default_f_tick) { }
1434 20 71 if $maxtickLabelLen < length $labelText
1443 9 42 if $f_min
1446 15 36 if $f_max
1449 0 51 if ($d_min > $d_max)
1459 0 51 if (0 == $d_width)
1482 4 47 if ($rangeExponent < 0) { }
1491 9 42 if ($temp_rangeExponent + 1 > $precision)
1499 456 0 if (defined $$self{'f_y_tick'}) { }
1502 326 130 if ($$self{'f_y_tick'} == \&_default_f_tick and $prec_test == 0) { }
66 64 elsif ($$self{'f_y_tick'} == \&_default_f_tick and $prec_test == 1) { }
1518 83 373 if $maxtickLabelLen < length $labelText
1547 0 54 if ($minTicks < 2)
1553 0 54 if ($maxTicks < 5 * $minTicks)
1573 0 125 if ($maxTicks < $tickCount) { }
71 54 elsif ($minTicks > $tickCount) { }
1578 0 0 if (not defined $divisor or $divisor == 0)
1594 0 54 if $minF and int $min * $divisor != $min * $divisor
1595 0 54 if $maxF and int $max * $divisor != $max * $divisor
1614 0 4 if ($minTicks < 2)
1620 0 4 if ($maxTicks < 5 * $minTicks)
1640 0 10 if ($maxTicks < $tickCount) { }
6 4 elsif ($minTicks > $tickCount) { }
1645 0 0 if (not defined $divisor or $divisor == 0)
1661 0 4 if $minF and int $min * $divisor != $min * $divisor
1662 0 4 if $maxF and int $max * $divisor != $max * $divisor
1696 0 300 if $interval == 0
1697 0 300 unless 1 == $roundUP * $roundUP
1702 189 111 0 == $fracN || $roundUP * $fracN < 0 ? :
1715 0 62 if $num == 0
1717 62 0 $num > 0 ? :
1734 35512 9 if (defined $datum)
1738 35463 49 if (defined $max) { }
1739 284 35179 if ($datum > $max) { }
10273 24906 elsif ($datum < $min) { }
1757 383 0 if (defined $datum)
1758 379 4 if (defined $max) { }
1759 379 0 if ($datum > $max) { }
0 0 elsif ($datum < $min) { }
1782 21 39 if $$self{'x_label'}
1783 31 29 if $$self{'y_label'}
1784 10 50 if $$self{'y_label2'}
1790 39 21 if $$self{'grey_background'} =~ /^true$/i
1793 0 60 if ($$self{'grey_background'} =~ /^true$/i and $self->isa('Chart::Direction'))
1796 22 38 if $$self{'grid_lines'} =~ /^true$/i
1797 3 57 if $$self{'x_grid_lines'} =~ /^true$/i
1798 12 48 if $$self{'y_grid_lines'} =~ /^true$/i
1799 0 60 if $$self{'y2_grid_lines'} =~ /^true$/i
1815 14 30 if ($$self{'legend'} =~ /^none$/)
1820 0 30 if ($#{$$self{'legend_labels'};} >= 0 and scalar @{$$self{'legend_labels'};} != $$self{'num_datasets'})
1826 30 0 unless ($$self{'max_legend_label'})
1832 59 31 unless ($$self{'legend_labels'}[$_ - 1])
1836 34 56 if ($length > $$self{'max_legend_label'})
1842 10 20 if ($$self{'legend'} eq 'bottom') { }
14 6 elsif ($$self{'legend'} eq 'right') { }
4 2 elsif ($$self{'legend'} eq 'left') { }
2 0 elsif ($$self{'legend'} eq 'top') { }
1871 0 8 unless (ref $font eq 'GD::Font')
1884 0 8 if ($$self{'y_axes'} =~ /^right$/i) { }
1 7 elsif ($$self{'y_axes'} =~ /^both$/i) { }
1896 4 4 if ($$self{'y_label'})
1899 3 5 if ($$self{'y_label2'})
1909 0 8 unless ($cols)
1916 6 2 unless ($$self{'num_datasets'} % $cols == 0)
1919 0 8 unless ($rows)
1939 33 12 if ($labels[$index])
1987 0 12 unless (ref $font eq 'GD::Font')
2075 0 1 unless (ref $font eq 'GD::Font')
2088 0 1 if ($$self{'y_axes'} =~ /^right$/i) { }
0 1 elsif ($$self{'y_axes'} =~ /^both$/i) { }
2105 0 1 unless ($cols)
2112 0 1 unless ($$self{'num_datasets'} % $cols == 0)
2115 0 1 unless ($rows)
2137 3 0 if ($labels[$index])
2183 0 3 unless (ref $font eq 'GD::Font')
2271 4 18 if (defined $$self{'colors'}{'x_label'}) { }
2280 0 22 unless (ref $font eq 'GD::Font')
2311 31 10 if ($side eq 'left') { }
10 0 elsif ($side eq 'right') { }
2321 0 41 unless (ref $font eq 'GD::Font')
2329 31 10 if ($side eq 'left') { }
10 0 elsif ($side eq 'right') { }
2342 31 10 if ($side eq 'left') { }
10 0 elsif ($side eq 'right') { }
2359 4 48 if ($$self{'xy_plot'} =~ /^true$/i and $self->isa('Chart::Lines') || $self->isa('Chart::Points') || $self->isa('Chart::LinesPoints') || $self->isa('Chart::Split') || $self->isa('Chart::ErrorBars')) { }
2386 0 4 unless (ref $font eq 'GD::Font')
2401 0 4 if ($$self{'y_axes'} =~ /^right$/i) { }
2 2 elsif ($$self{'y_axes'} =~ /^both$/i) { }
2424 4 0 if ($$self{'x_ticks'} =~ /^normal/i) { }
0 0 elsif ($$self{'x_ticks'} =~ /^staggered/i) { }
0 0 elsif ($$self{'x_ticks'} =~ /^vertical/i) { }
2442 0 0 if (not $_ % 2) { }
2478 18 13 if ($$self{'grid_lines'} =~ /^true$/i or $$self{'x_grid_lines'} =~ /^true$/i)
2503 0 34 unless (ref $font eq 'GD::Font')
2526 0 34 if ($$self{'y_axes'} =~ /^right$/i) { }
6 28 elsif ($$self{'y_axes'} =~ /^both$/i) { }
2549 34 0 $$self{'num_datapoints'} > 0 ? :
2550 27 7 if (not defined $$self{'skip_x_ticks'}) { }
0 7 elsif ($$self{'skip_x_ticks'} == 0) { }
2555 8 26 if ($delta <= $$self{'x_tick_label_length'} * $w / $$self{'skip_x_ticks'})
2556 0 8 if ($$self{'x_ticks'} =~ /^normal$/i)
2562 21 13 if ($$self{'x_ticks'} =~ /^normal$/i) { }
0 13 elsif ($$self{'x_ticks'} =~ /^staggered$/i) { }
13 0 elsif ($$self{'x_ticks'} =~ /^vertical$/i) { }
2563 1 20 if ($$self{'skip_x_ticks'} > 1) { }
0 20 elsif ($$self{'custom_x_ticks'}) { }
2565 9 1 if (defined $$data[0][$_ * $$self{'skip_x_ticks'}])
2575 0 0 if (defined $_)
2584 142 0 if (defined $_)
2594 0 0 if ($$self{'skip_x_ticks'} > 1) { }
0 0 elsif ($$self{'custom_x_ticks'}) { }
2597 0 0 if (defined $$data[0][$_ * $$self{'skip_x_ticks'}])
2600 0 0 if ($stag % 2 == 1)
2606 0 0 if ($stag % 2 == 1)
2616 0 0 if (defined $_)
2618 0 0 if ($stag % 2 == 1)
2622 0 0 if ($stag % 2 == 1)
2631 0 0 if (defined $$self{'f_x_tick'}($$data[0][$_]))
2633 0 0 if ($_ % 2 == 1)
2637 0 0 if ($_ % 2 == 1)
2646 5 8 if ($$self{'skip_x_ticks'} > 1) { }
0 8 elsif ($$self{'custom_x_ticks'}) { }
2648 105 0 if (defined $_)
2660 0 0 if (defined $_)
2671 118 0 if (defined $_)
2686 21 13 if ($$self{'x_ticks'} =~ /^normal$/i) { }
0 13 elsif ($$self{'x_ticks'} =~ /^staggered$/i) { }
13 0 elsif ($$self{'x_ticks'} =~ /^vertical$/i) { }
2700 6 28 if ($$self{'skip_x_ticks'} > 1) { }
0 28 elsif ($$self{'custom_x_ticks'}) { }
2704 67 48 if ($$self{'grid_lines'} =~ /^true$/i or $$self{'x_grid_lines'} =~ /^true$/i)
2714 0 0 if ($$self{'grid_lines'} =~ /^true$/i or $$self{'x_grid_lines'} =~ /^true$/i)
2724 132 128 if ($$self{'grid_lines'} =~ /^true$/i or $$self{'x_grid_lines'} =~ /^true$/i)
2754 0 53 unless (ref $font eq 'GD::Font')
2762 39 14 if ($$self{'min_val'} >= 0) { }
1 13 elsif ($$self{'max_val'} <= 0) { }
2776 8 45 if ($side eq 'right') { }
8 37 elsif ($side eq 'both') { }
2783 0 8 if $$self{'y_ticks'} < 2
2794 4 40 if ($$self{'grid_lines'} =~ /^true$/i or $$self{'y2_grid_lines'} =~ /^true$/i)
2839 68 6 if ($$self{'grid_lines'} =~ /^true$/i or $$self{'y_grid_lines'} =~ /^true$/i)
2865 51 23 if ($$self{'grid_lines'} =~ /^true$/i or $$self{'y2_grid_lines'} =~ /^true$/i)
2888 0 37 if $$self{'y_ticks'} < 2
2909 200 130 if ($$self{'grid_lines'} =~ /^true$/i or $$self{'y_grid_lines'} =~ /^true$/i)
2954 262 0 if (defined $x)
2968 4 31 if ($self->isa('Chart::HorizontalBars')) { }
2991 3 20 if ($self->isa('Chart::HorizontalBars')) { }
3027 0 9280 if (not length $type or not grep {$type eq $_;} 'line', 'point')
3031 0 0 if ref $self eq 'Chart::Lines'
3032 0 0 if ref $self eq 'Chart::Points'
3043 9201 79 if ($type eq 'line') { }
79 0 elsif ($type eq 'point') { }
3058 9201 79 if ($type eq 'line')
3073 79 9201 if ($type eq 'point')
3076 79 0 unless grep {$typeStyle eq $_;} 'circle', 'donut', 'triangle', 'upsidedownTriangle', 'square', 'hollowSquare', 'fatPlus'
3086 79 0 if (grep {$typeStyle eq $_;} 'default', 'circle', 'donut')
3094 0 79 if ($typeStyle eq 'donut')
3101 0 79 if (grep {$typeStyle eq $_;} 'triangle', 'upsidedownTriangle')
3104 0 0 $typeStyle eq 'triangle' ? :
3119 0 79 if ($typeStyle eq 'fatPlus')
3143 0 79 if (grep {$typeStyle eq $_;} 'square', 'hollowSquare')
3152 0 0 if ($typeStyle eq 'hollowSquare')