Chart/GGPlot/Geom/Text.pm

filter: Statementstmt 56.6% 30 / 53 Branchbran 9.0% 2 / 22 Conditioncond 0.0% 0 / 3 MC/DCmcdc 0.0% 0 / 2 Subroutinesub 60.0% 6 / 10 Podpod 0.0% 0 / 3 totaltotal 40.8% 38 / 93 CC 13 SCAR 30.7
CC
13
Cov
41%
__ANON__
56.0
setup_data
12.0
required_aes
9.6
CRAP 21.5
« Chart/GGPlot/Theme.pm ↑ Summary Chart/GGPlot/Backend/Plotly/Geom.pm »
1 ## Please see file perltidy.ERR
2 package Chart::GGPlot::Geom::Text;
3  
4 # ABSTRACT: Class for line geom
5  
6 5 ▶use Chart::GGPlot::Class qw(:pdl);
Subroutine BEGIN: called CC=1 SCAR=0.0
7 5 ▶use namespace::autoclean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 5 extends qw(Chart::GGPlot::Geom::Path);
10  
11 5 our $VERSION = '0.002003'; # VERSION
12  
13 5 ▶use Chart::GGPlot::Layer;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 5 ▶use Chart::GGPlot::Util qw(NA);
Subroutine BEGIN: called CC=1 SCAR=0.0
15 5 ▶use Chart::GGPlot::Util::Pod qw(layer_func_pod);
Subroutine BEGIN: called CC=1 SCAR=0.0
16  
17 has '+default_aes' => (
18 0 ▶ default => sub {
Subroutine __ANON__: not called CC=1 SCAR=6.9
19 0 Chart::GGPlot::Aes->new(
20 color => PDL::SV->new( ['black'] ),
21 size => pdl(3.88),
22 angle => pdl(0),
23 hjust => PDL::SV->new( ['center'] ),
24 vjust => PDL::SV->new( ['center'] ),
25 alpha => NA(),
26 family => PDL::SV->new( ["sans"] ),
27 );
28 }
29 5 );
30  
31 0 ▶classmethod required_aes() { [qw(x y label)] }
Subroutine required_aes: not called CC=3 SCAR=22.6
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for classmethod required_aes (expected 1, got ' . @_ . ')') 0 0 0
@_ > 1 and Function::Parameters::_croak('Too many arguments for classmethod required_aes (expected 1, got ' . @_ . ')') 0 0 0
32  
33 5 my $geom_text_pod = layer_func_pod(<<'EOT');
34  
35 geom_text(:$mapping=undef, :$data=undef, :$stat='identity',
36 :$position='identity',
37 :$na_rm=false, :$show_legend=undef, :$inherit_aes=true,
38 %rest)
39  
40 C<geom_text()> adds text to the plot.
41  
42 Arguments:
43  
44 =over 4
45  
46 %TMPL_COMMON_ARGS%
47  
48 =item * $hjust, $vjust
49  
50 You can modify text alignment with the C<hjust> and C<vjust> aesthetics.
51 These can either be a number between 0 (right/bottom) and 1 (top/left) or a
52 string, (C<"left">, C<"right">, C<"bottom">, C<"top">,
53 C<"center">/C<"middle">).
54  
55 =item * $family
56  
57 Font family. Default is C<"sans">.
58  
59 =item * $size
60  
61 Font size in mm. Default is 3.88 mm (11pt).
62  
63 =back
64  
65 EOT
66  
67 0 ▶my $geom_text_code = fun(
Subroutine __ANON__: not called CC=7 SCAR=40.3
Branch: 1 branch
BranchTrueFalseTotal
@_ > 0 and @_ % 2 and Function::Parameters::_croak("Odd number of paired arguments for fun (anon)") 0 0 0
Condition0%0/3
@_ > 0 and @_ % 2
!ll&&!rl&&r
000
MC/DC0%0/2
@_ > 0 and @_ % 2
@_ > 0 @_ % 2
Truth table0%0/3
A and B
A= @_ > 0B= @_ % 2
ABresult
0X0
100
111
68 : $mapping = undef,
69 : $data = undef,
70 : $stat = 'identity',
71 : $position = 'identity',
72 : $na_rm = false,
73 : $show_legend = undef,
74 : $inherit_aes = true,
75 %rest
76 )
77 0 ▶{
Branch: 4 branches
BranchTrueFalseTotal
exists $rest{'stat'} ? : 0 0 0
exists $rest{'position'} ? : 0 0 0
exists $rest{'na_rm'} ? : 0 0 0
exists $rest{'inherit_aes'} ? : 0 0 0
78 0 return Chart::GGPlot::Layer->new(
79 data => $data,
80 mapping => $mapping,
81 stat => $stat,
82 position => $position,
83 show_legend => $show_legend,
84 inherit_aes => $inherit_aes,
85 geom => 'text',
86 params => { na_rm => $na_rm, %rest },
87 );
88 5 };
89  
90 5 ▶classmethod ggplot_functions() {
Subroutine ggplot_functions: called CC=3 SCAR=11.3
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for classmethod ggplot_functions (expected 1, got ' . @_ . ')') 0 5 5
@_ > 1 and Function::Parameters::_croak('Too many arguments for classmethod ggplot_functions (expected 1, got ' . @_ . ')') 0 5 5
91 return [
92 {
93 5 name => 'geom_text',
94 code => $geom_text_code,
95 pod => $geom_text_pod,
96 }
97 ];
98 5 }
99  
100 0 ▶method setup_data( $data, $params ) {
Subroutine setup_data: not called CC=3 SCAR=24.8
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 3 and Function::Parameters::_croak('Too few arguments for method setup_data (expected 3, got ' . @_ . ')') 0 0 0
@_ > 3 and Function::Parameters::_croak('Too many arguments for method setup_data (expected 3, got ' . @_ . ')') 0 0 0
101 0 return $data->sort( [qw(PANEL group x)] );
102 5 }
103  
104 5 __PACKAGE__->meta->make_immutable( inline_constructor => 0 );
105  
106 5 1;
107  
108 __END__
« Chart/GGPlot/Theme.pm ↑ Summary Chart/GGPlot/Backend/Plotly/Geom.pm »