Chart/GGPlot/Position/Dodge2.pm

filter: Statementstmt 90.9% 40 / 44 Branchbran 50.0% 5 / 10 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 80.0% 8 / 10 Podpod 0.0% 0 / 2 totaltotal 80.3% 53 / 66 CC 6 SCAR 9.4
CC
6
Cov
83%
setup_params
4.8
compute_panel
3.1
__ANON__
2.0
CRAP 2.6
« Chart/GGPlot/Aes/Functions.pm ↑ Summary Chart/GGPlot/Theme/Rel.pm »
1 package Chart::GGPlot::Position::Dodge2;
2  
3 # ABSTRACT: Position for 'dodge2'
4  
5 6 ▶use Chart::GGPlot::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 6 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 6 our $VERSION = '0.002003'; # VERSION
9  
10 6 extends 'Chart::GGPlot::Position::Dodge';
11  
12 6 ▶use List::AllUtils qw(count_by);
Subroutine BEGIN: called CC=1 SCAR=0.0
13 6 ▶use Types::Standard qw(Num);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 6 ▶use Chart::GGPlot::Position::Util qw(collide2 pos_dodge2);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17  
18 6 has padding => ( is => 'ro', isa => Num, default => 0.1 );
19 1 ▶has reverse => ( is => 'ro', default => sub { false } );
Subroutine __ANON__: called CC=1 SCAR=0.0
20  
21 6 with qw(Chart::GGPlot::Position);
22  
23 1 ▶method setup_params ($data) {
Subroutine setup_params: called CC=4 SCAR=15.7
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 2 and Function::Parameters::_croak('Too few arguments for method setup_params (expected 2, got ' . @_ . ')') 0 1 1
@_ > 2 and Function::Parameters::_croak('Too many arguments for method setup_params (expected 2, got ' . @_ . ')') 0 1 1
24 1 my $splitted = $data->split( $data->at('PANEL') );
25 1 my $n;
26 1 ▶ if ( $self->preserve ne 'total' ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->preserve ne "total") 0 1 1
27 $n = List::AllUtils::max(
28 $splitted->values->map(
29 0 ▶ sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
30 0 ▶ my %count = count_by { $_ } $_->at('xmin')->flatten;
Subroutine __ANON__: not called CC=1 SCAR=6.9
31 0 return List::AllUtils::max( values(%count), 1 );
32 }
33 0 )->flatten
34 );
35 }
36  
37 return {
38 1 width => $self->width,
39 n => $n,
40 padding => $self->padding,
41 reverse => $self->reverse
42 };
43 6 }
44  
45 1 ▶method compute_panel ($data, $params, $scales) {
Subroutine compute_panel: called CC=3 SCAR=11.2
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 4 and Function::Parameters::_croak('Too few arguments for method compute_panel (expected 4, got ' . @_ . ')') 0 1 1
@_ > 4 and Function::Parameters::_croak('Too many arguments for method compute_panel (expected 4, got ' . @_ . ')') 0 1 1
46 return collide2(
47 $data, $params->{width}, 'position_dodge2', \&pos_dodge2,
48 n => $params->{n},
49 padding => $params->{padding},
50 check_width => false,
51 reverse => $params->{reverse},
52 1 );
53 6 }
54  
55 6 __PACKAGE__->meta->make_immutable;
56  
57 6 1;
58  
59 __END__
« Chart/GGPlot/Aes/Functions.pm ↑ Summary Chart/GGPlot/Theme/Rel.pm »