Branch Coverage

blib/lib/Excel/Writer/XLSX/Chart.pm
Criterion Covered Total %
branch 644 726 88.7


line true false branch
51 0 437 if $@
154 406 20 if $self->{'_embedded'}
183 0 1037 unless (exists $arg{'values'})
187 0 1037 if ($self->{'_requires_category'} and not exists $arg{'categories'})
191 0 1037 if (@{$self->{'_series'};} == 255)
214 7 1030 if ($arg{'border'})
228 56 981 if ($pattern)
233 11 1026 if ($gradient)
265 13 1024 if ($x2_axis or $y2_axis)
270 7 1030 if (defined $arg{'gap'})
271 2 5 if ($y2_axis) { }
280 7 1030 if (defined $arg{'overlap'})
281 2 5 if ($y2_axis) { }
471 6 0 defined $_[0] ? :
473 2 4 if ($style_id < 0 or $style_id > 48)
492 0 6 unless $option
501 0 6 unless (exists $valid{$option})
535 1 2 if $args{'width'}
536 1 2 if $args{'height'}
537 1 2 if $args{'x_scale'}
538 1 2 if $args{'y_scale'}
539 1 2 if $args{'x_offset'}
540 1 2 if $args{'y_offset'}
566 2 1 if defined $args{'horizontal'}
567 2 1 if defined $args{'vertical'}
568 2 1 if defined $args{'outline'}
569 2 1 if defined $args{'show_keys'}
588 0 3 if (defined $args{'up'}{'border'})
591 1 2 if (defined $args{'down'}{'border'})
712 1061 1610 defined $arg{'visible'} ? :
717 936 1198 if ($arg{'major_gridlines'} and $arg{'major_gridlines'}{'visible'})
723 9 0 if ($arg{'minor_gridlines'} and $arg{'minor_gridlines'}{'visible'})
730 11 2660 if (defined $arg{'display_units_visible'}) { }
738 527 2144 if (defined $axis->{'_position'})
743 3 2668 if (defined $axis->{'_position_axis'})
744 2 1 if ($axis->{'_position_axis'} eq 'on_tick') { }
1 0 elsif ($axis->{'_position_axis'} eq 'between') { }
758 4 2667 if ($arg{'date_axis'})
763 1 2670 if ($arg{'text_axis'})
802 5346 65 unless $args
818 8 57 if $font->{'_size'}
821 21 44 if ($font->{'_rotation'})
841 2041 33 unless ref $data
861 85 3647 if (defined $name)
863 1 84 if (ref $name eq 'ARRAY') { }
20 64 elsif ($name =~ /^=[^!]+!\$/) { }
894 0 255 unless defined $data
895 0 255 if @$data == 0
897 3 252 if (ref $data->[0] eq "ARRAY")
903 1 1219 unless defined $token
904 9 1210 unless $token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/
932 4483 1330 unless $formula
939 1211 119 if (not exists $self->{'_formula_ids'}{$formula}) { }
953 114 5 unless (defined $self->{'_formula_data'}[$id])
974 187 82 if (defined $color and $color =~ /^#[0-9a-fA-F]{6}$/)
982 0 82 unless ($index)
1050 2 0 if (exists $patterns{$value}) { }
1085 1 0 if (exists $weights{$value}) { }
1107 4864 63 unless $line
1129 28 35 if (defined $dash_type)
1130 28 0 if (exists $dash_types{$dash_type}) { }
1156 3875 51 unless $fill
1176 1190 59 unless $args
1179 0 59 unless ($args->{'pattern'})
1185 0 59 unless ($args->{'fg_color'})
1251 59 0 if (exists $types{$pattern_type}) { }
1260 50 9 if (not $args->{'bg_color'}) { }
1292 1235 14 unless $args
1295 0 14 if (not $args->{'colors'} or ref $args->{'colors'} ne "ARRAY")
1301 0 14 if (@{$args->{'colors'};} < 2)
1308 2 12 if ($args->{'positions'}) { }
1311 0 2 if (@{$args->{'positions'};} != @{$args->{'colors'};})
1318 0 5 if ($pos < 0 or $pos > 100)
1329 1 11 if (@{$args->{'colors'};} == 2) { }
10 1 elsif (@{$args->{'colors'};} == 3) { }
1 0 elsif (@{$args->{'colors'};} == 4) { }
1345 2 12 if (defined $args->{'angle'}) { }
1348 0 2 if ($angle < 0 or $angle > "359.9")
1360 3 11 if (defined $args->{'type'}) { }
1363 0 3 unless (exists $types{$type})
1388 1026 11 if not $marker and ref $marker ne "HASH"
1413 11 0 if (defined $marker_type)
1414 6 5 if ($marker_type eq "automatic")
1418 11 0 if (exists $types{$marker_type}) { }
1431 0 11 if ($marker->{'border'})
1445 0 11 if ($pattern)
1450 0 11 if ($gradient)
1476 1024 13 if not $trendline and ref $trendline ne "HASH"
1493 13 0 if (exists $types{$trend_type}) { }
1505 0 13 if ($trendline->{'border'})
1519 0 13 if ($pattern)
1524 0 13 if ($gradient)
1549 2060 14 if not $args and ref $args ne "HASH"
1578 14 0 if (exists $types{$error_type}) { }
1587 3 11 if (defined $args->{'value'})
1592 1 13 if (defined $args->{'end_style'})
1597 2 12 if (defined $args->{'direction'})
1598 1 1 if ($args->{'direction'} eq 'minus') { }
1 0 elsif ($args->{'direction'} eq 'plus') { }
1610 3 11 if (defined $args->{'plus_values'})
1613 3 11 if (defined $args->{'minus_values'})
1616 1 13 if (defined $args->{'plus_data'})
1619 1 13 if (defined $args->{'minus_data'})
1663 963 92 if not $labels and ref $labels ne "HASH"
1669 52 40 if (my $position = $labels->{'position'})
1671 52 0 if (exists $self->{'_label_positions'}{$position}) { }
1672 13 39 if ($position eq $self->{'_label_position_default'}) { }
1686 6 86 if (my $separator = $labels->{'separator'})
1696 6 0 if (exists $separators{$separator}) { }
1709 5 87 if ($labels->{'border'})
1723 1 91 if ($pattern)
1728 1 91 if ($gradient)
1739 6 86 if ($labels->{'font'})
1743 22 70 if ($labels->{'custom'})
1749 3 27 unless (defined $label)
1757 8 19 if ($property{'value'} and $property{'value'} =~ /^=[^!]+!\$/)
1761 10 17 if ($property{'formula'})
1769 8 19 if ($property{'font'})
1777 9 18 if ($property{'border'})
1791 0 27 if ($pattern)
1796 0 27 if ($gradient)
1830 2 18 if ($arg{'color'})
1835 1 19 if ($arg{'line_weight'})
1841 2 18 if ($arg{'line_pattern'})
1844 1 1 if ($pattern eq 'none') { }
1853 1 19 if ($arg{'line_color'})
1864 13 7 if ($arg{'border'})
1878 2 18 if ($pattern)
1883 2 18 if ($gradient)
1921 2 29 if ($arg{'none'})
1929 1 30 if ($arg{'border'})
1943 0 31 if ($pattern)
1948 0 31 if ($gradient)
1981 2763 11 unless $args
1983 6 5 if ($is_text) { }
1995 0 32 unless (exists $allowable{$key})
2004 0 32 unless (exists $args->{$property})
2011 0 32 unless ($value =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/)
2017 0 32 if ($value < 0 or $value > 1)
2043 1028 9 unless $user_points
2049 18 4 if (defined $user_point)
2055 1 17 if ($user_point->{'border'})
2072 0 18 if ($pattern)
2077 0 18 if ($gradient)
2082 0 18 if ($gradient)
2108 3293 248 if (not $element->{'_line'}{'_defined'} || $element->{'_fill'}{'_defined'} || $element->{'_pattern'} || $element->{'_gradient'}) { }
2132 2659 12 unless $display_units
2146 12 0 if (exists $types{$display_units}) { }
2170 5337 5 unless $tick_type
2179 5 0 if (exists $types{$tick_type}) { }
2203 959 12 unless $series->{'_y2_axis'}
2222 12 959 if $series->{'_y2_axis'}
2245 373 12 if $args{'primary_axes'}
2246 12 373 if not $args{'primary_axes'}
2261 148 85 unless $font
2264 8 77 if $font->{'_size'}
2265 32 53 if defined $font->{'_bold'}
2266 31 54 if defined $font->{'_italic'}
2267 2 83 if defined $font->{'_underline'}
2270 32 53 if ($font->{'_baseline'} != -1)
2289 148 85 unless $font
2292 12 73 if $font->{'_name'}
2295 12 73 if defined $font->{'_pitch_family'}
2298 12 73 if defined $font->{'_charset'}
2427 427 3 if $style_id == 2
2449 1 425 if ($self->{'_title_none'}) { }
2456 5 420 if ($title = $self->{'_title_formula'}) { }
15 405 elsif ($title = $self->{'_title_name'}) { }
2507 422 4 if $val eq "gap"
2537 8 330 if ($second_chart)
2540 4 4 if ($second_chart->{'_is_secondary'}) { }
2565 16 322 if ($self->{'_date_category'}) { }
2584 4 4 if ($second_chart and $second_chart->{'_is_secondary'})
2596 16 322 if ($self->{'_date_category'}) { }
2625 946 9 if (not $layout) { }
2652 1 8 if ($type eq "plot")
2663 3 6 if ($type ne "text")
2767 214 756 if ($self->{'_smooth_allowed'})
2821 11 1021 if ($name = $series->{'_name_formula'}) { }
2 1019 elsif ($name = $series->{'_name'}) { }
2845 193 777 if (defined $data_id)
2850 777 193 unless $formula
2857 7 186 if ($type eq 'str') { }
3 183 elsif ($type eq 'multi_str') { }
2927 1277 0 if ($type eq 'num') { }
0 0 elsif ($type eq 'str') { }
2960 0 44 if ($type eq 'num') { }
44 0 elsif ($type eq 'str') { }
2988 0 3 unless $count
3051 373 12 if ($args{'primary_axes'}) { }
3097 0 644 unless $axis_ids
3098 312 332 unless scalar @$axis_ids
3113 10 322 unless $x_axis->{'_visible'}
3126 3 329 if ($title = $x_axis->{'_formula'}) { }
19 310 elsif ($title = $x_axis->{'_name'}) { }
3157 328 4 if ($self->{'_show_crosses'} or $x_axis->{'_visible'})
3160 327 1 if (not defined $y_axis->{'_crossing'} or $y_axis->{'_crossing'} eq 'max' or $y_axis->{'_crossing'} eq 'min') { }
3175 331 1 unless ($x_axis->{'_text_axis'})
3213 361 381 unless $axis_ids and scalar @$axis_ids
3228 0 381 unless $y_axis->{'_visible'}
3241 5 376 if ($title = $y_axis->{'_formula'}) { }
20 356 elsif ($title = $y_axis->{'_name'}) { }
3272 379 2 if (not defined $x_axis->{'_crossing'} or $x_axis->{'_crossing'} eq 'max' or $x_axis->{'_crossing'} eq 'min') { }
3319 30 32 unless $axis_ids and scalar @$axis_ids
3334 1 31 unless $x_axis->{'_visible'}
3347 1 31 if ($title = $x_axis->{'_formula'}) { }
1 30 elsif ($title = $x_axis->{'_name'}) { }
3378 31 1 if (not defined $y_axis->{'_crossing'} or $y_axis->{'_crossing'} eq 'max' or $y_axis->{'_crossing'} eq 'min') { }
3422 15 17 unless $axis_ids and scalar @$axis_ids
3439 1 16 unless $x_axis->{'_visible'}
3452 0 17 if ($title = $x_axis->{'_formula'}) { }
1 16 elsif ($title = $x_axis->{'_name'}) { }
3482 16 1 if ($self->{'_show_crosses'} or $x_axis->{'_visible'})
3485 16 0 if (not defined $y_axis->{'_crossing'} or $y_axis->{'_crossing'} eq 'max' or $y_axis->{'_crossing'} eq 'min') { }
3515 3 14 if (defined $x_axis->{'_major_unit'})
3523 3 14 if (defined $x_axis->{'_minor_unit'})
3574 761 1 unless $val
3594 5 758 if $reverse
3613 755 7 unless defined $max
3632 755 7 unless defined $min
3652 5 758 if ($reverse)
3653 3 2 if $val eq "l"
3654 2 3 if $val eq "b"
3679 8 424 if ($format_code ne $axis->{'_defaults'}{'num_format'})
3684 4 428 if ($axis->{'_num_format_linked'})
3713 6 328 if ($format_code ne $axis->{'_defaults'}{'num_format'})
3719 2 332 if ($axis->{'_num_format_linked'})
3724 261 73 if (not $self->{'_cat_has_num_fmt'} and $default_format)
3769 755 7 unless $val
3788 760 2 unless $val
3807 2 761 if ($val eq "next_to")
3896 1 332 if ($val eq "right")
3900 1 332 if ($val eq "left")
3938 347 2 unless $val
3957 348 1 unless $val
3976 384 379 unless $gridlines
3977 0 379 unless $gridlines->{'_visible'}
3979 2 377 if ($gridlines->{'_line'}{'_defined'}) { }
4004 753 9 unless $gridlines
4005 0 9 unless $gridlines->{'_visible'}
4007 2 7 if ($gridlines->{'_line'}{'_defined'}) { }
4050 424 6 unless $val
4069 424 6 unless $val
4126 4 377 if (defined $legend->{'_delete_series'} and ref $legend->{'_delete_series'} eq "ARRAY")
4132 5 376 if ($position =~ s/^overlay_//)
4144 3 378 if $position eq "none"
4145 1 377 unless exists $allowed{$position}
4165 5 372 if $overlay
4171 2 375 if ($font)
4248 1 426 if $self->{'_show_hidden_data'}
4378 1 55 if $overlay
4409 1 13 if $overlay
4473 25 0 if (defined $data_id)
4502 21 0 if ($font and exists $font->{'_rotation'})
4534 18 157 if (not defined $rot and $is_y_axis)
4538 43 132 if (defined $rot)
4539 4 39 if ($rot == 16200000) { }
4 35 elsif ($rot == 16260000) { }
4591 58 7 unless ($ignore_rich_pr)
4680 12 52 if $font and $font->{'_color'}
4682 17 151 if (@latin_attributes or $has_color) { }
4686 12 5 if ($has_color)
4690 9 8 if (@latin_attributes)
4759 4 17 if $font and $font->{'_color'}
4765 4 61 if (@latin_attributes or $has_color) { }
4769 4 0 if ($has_color)
4773 3 1 if (@latin_attributes)
4815 15 0 if ($font and exists $font->{'_rotation'})
4845 759 274 unless $marker
4846 6 268 if $marker->{'automatic'}
4855 16 252 if $size
4909 3273 235 unless _has_fill_formatting($series)
4914 51 184 if ($series->{'_fill'}{'_defined'})
4916 6 45 if ($series->{'_fill'}{'none'}) { }
4927 59 176 if ($series->{'_pattern'})
4933 14 221 if ($series->{'_gradient'})
4941 141 94 if ($series->{'_line'}{'_defined'})
4962 92 49 if (my $width = $line->{'width'})
4976 86 55 if ($line->{'none'}) { }
49 6 elsif ($line->{'color'}) { }
4988 28 113 if (my $type = $line->{'dash_type'})
5025 110 0 if ($fill->{'color'})
5051 6 263 if ($transparency) { }
5112 1019 13 unless $trendline
5126 4 9 if ($trendline->{'type'} eq "poly")
5131 1 12 if ($trendline->{'type'} eq "movingAvg")
5141 2 11 if (defined $trendline->{'intercept'})
5146 4 9 if ($trendline->{'display_r_squared'})
5151 6 7 if ($trendline->{'display_equation'})
5191 9 4 unless defined $data
5206 4 0 defined $_[0] ? :
5223 1 0 defined $_[0] ? :
5242 9 4 unless $val
5261 9 4 unless $val
5370 91 14 unless $hi_low_lines
5372 1 13 if ($hi_low_lines->{'_line'}{'_defined'}) { }
5399 113 4 unless $drop_lines
5401 1 3 if ($drop_lines->{'_line'}{'_defined'}) { }
5427 216 12 unless defined $val
5447 1278 0 if (defined $data)
5463 3 6185 if (defined $token and not $token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/)
5548 18 6283 unless defined $value
5586 425 1 unless $self->{'_protection'}
5604 1023 9 unless $points
5609 4 18 unless $point
5652 958 92 unless $labels
5657 22 70 if ($labels->{'custom'})
5662 4 88 if ($labels->{'num_format'})
5670 6 86 if ($labels->{'font'})
5675 39 53 if $labels->{'position'}
5678 3 89 if $labels->{'legend_key'}
5681 89 3 if $labels->{'value'}
5684 13 79 if $labels->{'category'}
5687 7 85 if $labels->{'series_name'}
5690 3 89 if $labels->{'percentage'}
5693 6 86 if $labels->{'separator'}
5696 14 78 if $labels->{'leader_lines'}
5717 3 27 unless defined $label
5724 4 23 if (defined $label->{'delete'} and $label->{'delete'}) { }
10 13 elsif (defined $label->{'formula'}) { }
9 4 elsif (defined $label->{'value'}) { }
5730 1 9 if ($parent->{'position'})
5734 10 0 if $parent->{'value'}
5735 0 10 if $parent->{'category'}
5736 0 10 if $parent->{'series_name'}
5741 1 8 if ($parent->{'position'})
5745 9 0 if $parent->{'value'}
5746 1 8 if $parent->{'category'}
5747 1 8 if $parent->{'series_name'}
5803 10 0 if (defined $data_id)
5835 7 7 if ($has_formatting) { }
2 5 elsif ($font) { }
6008 968 2 unless $invert
6027 740 28 unless $font
6068 335 3 unless $table
6072 1 2 if ($table->{'_horizontal'})
6078 1 2 if ($table->{'_vertical'})
6084 1 2 if ($table->{'_outline'})
6090 2 1 if ($table->{'_show_keys'})
6096 1 2 if ($table->{'_font'})
6179 0 1032 unless $error_bars
6181 2 1030 if ($error_bars->{'_x_error_bars'})
6185 12 1020 if ($error_bars->{'_y_error_bars'})
6204 0 14 unless $error_bars
6217 1 13 unless ($error_bars->{'_endcap'})
6223 8 6 if ($error_bars->{'_type'} eq 'stdErr') { }
3 3 elsif ($error_bars->{'_type'} eq 'cust') { }
6339 3 0 if ($error_bars->{'_plus_values'})
6344 2 1 if (ref $error_bars->{'_plus_values'} eq 'ARRAY') { }
6355 3 0 if ($error_bars->{'_minus_values'})
6360 2 1 if (ref $error_bars->{'_minus_values'} eq 'ARRAY') { }
6400 0 8 if (defined $token and not $token =~ /^([+-]?)(?=\d|\.\d)\d*(\.\d*)?([Ee]([+-]?\d+))?$/)
6427 103 3 unless $up_down_bars
6455 221 10 unless defined $val
6473 1 2 if ($format->{'_line'}{'_defined'} or $format->{'_fill'}{'_defined'}) { }
6499 1 2 if ($format->{'_line'}{'_defined'} or $format->{'_fill'}{'_defined'}) { }
6525 266 10 unless $smooth
6544 401 12 unless $units
6552 1 11 if ($display)
6580 11 3 if ($gradient->{'_type'} eq "linear")
6589 11 3 if ($gradient->{'_type'} eq 'linear') { }
6697 1 2 if ($type eq 'shape') { }
6730 1 2 if ($type eq 'shape') { }