Chart/GGPlot/Backend/Plotly/Geom/Bar.pm

filter: Statementstmt 37.2% 16 / 43 Branchbran 0.0% 0 / 14 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 50.0% 3 / 6 Podpod 0.0% 0 / 2 totaltotal 29.2% 19 / 65 CC 8 SCAR 24.3
CC
8
Cov
28%
:around
20.0
to_traces
12.0
split_on
9.6
CRAP 11.4
« Chart/GGPlot/Position/Stack.pm ↑ Summary Chart/GGPlot/Util/_Labeling.pm »
1 package Chart::GGPlot::Backend::Plotly::Geom::Bar;
2  
3 # ABSTRACT: Chart::GGPlot's Plotly implementation for Geom::Bar
4  
5 1 ▶use Chart::GGPlot::Class;
Subroutine BEGIN: called CC=1 SCAR=0.0
6  
7 1 our $VERSION = '0.002003'; # VERSION
8  
9 1 with qw(Chart::GGPlot::Backend::Plotly::Geom);
10  
11 1 ▶use Module::Load;
Subroutine BEGIN: called CC=1 SCAR=0.0
12  
13 1 ▶use Chart::GGPlot::Backend::Plotly::Util qw(to_rgb pdl_to_plotly);
Subroutine BEGIN: called CC=1 SCAR=0.0
14  
15 0 ▶classmethod split_on () { [qw(fill)] }
Subroutine split_on: not called CC=3 SCAR=22.6
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 1 and Function::Parameters::_croak('Too few arguments for classmethod split_on (expected 1, got ' . @_ . ')') 0 0 0
@_ > 1 and Function::Parameters::_croak('Too many arguments for classmethod split_on (expected 1, got ' . @_ . ')') 0 0 0
16  
17 0 ▶classmethod to_traces ($df, $params, $plot) {
Subroutine to_traces: not called CC=3 SCAR=24.8
Pod undocumented
Branch: 2 branches
BranchTrueFalseTotal
@_ < 4 and Function::Parameters::_croak('Too few arguments for classmethod to_traces (expected 4, got ' . @_ . ')') 0 0 0
@_ > 4 and Function::Parameters::_croak('Too many arguments for classmethod to_traces (expected 4, got ' . @_ . ')') 0 0 0
18 0 load Chart::Plotly::Trace::Bar;
19 0 load Chart::Plotly::Trace::Bar::Marker;
20  
21 0 my $fill = to_rgb( $df->at('fill') );
22 0 my $opacity = $df->at('alpha')->setbadtoval(1);
23  
24 0 my $marker = Chart::Plotly::Trace::Bar::Marker->new(
25 color => pdl_to_plotly( $fill, true ),
26 opacity => pdl_to_plotly( $opacity, true ),
27 );
28  
29 0 my $x = $df->at('x');
30 0 my $base = $df->at('ymin');
31 0 my $y = $df->at('ymax') - $base;
32 0 my $width = $df->at('xmax') - $df->at('xmin');
33  
34 0 my $trace = Chart::Plotly::Trace::Bar->new(
35 x => pdl_to_plotly($x),
36 y => pdl_to_plotly($y),
37 base => pdl_to_plotly( $base, true ),
38 width => pdl_to_plotly( $width, true ),
39 marker => $marker,
40 hovertext => pdl_to_plotly( $df->at('hovertext') ),
41 hoverinfo => 'text',
42 hoveron => $class->hover_on,
43 );
44 0 return [ $class->_adjust_trace_for_flip($trace, $plot) ];
45 1 }
46  
47 0 ▶around _hovertext_data_for_aes( $orig, $class : $df, $aes ) {
Subroutine :around: not called CC=4 SCAR=30.0
Branch: 2 branches
BranchTrueFalseTotal
@_ < 4 and Function::Parameters::_croak('Too few arguments for around _hovertext_data_for_aes (expected 4, got ' . @_ . ')') 0 0 0
@_ > 4 and Function::Parameters::_croak('Too many arguments for around _hovertext_data_for_aes (expected 4, got ' . @_ . ')') 0 0 0
48 return (
49 0 ▶ $aes eq 'y'
Branch: 1 branch
BranchTrueFalseTotal
$aes eq 'y' ? : 0 0 0
50 ? $df->at('ymax') - $df->at('ymin')
51 : $class->$orig( $df, $aes )
52 );
53 1 }
54  
55 1 __PACKAGE__->meta->make_immutable;
56  
57 1 1;
58  
59 __END__
« Chart/GGPlot/Position/Stack.pm ↑ Summary Chart/GGPlot/Util/_Labeling.pm »