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

filter: Statementstmt 51.5% 17 / 33 Branchbran 0.0% 0 / 6 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 66.6% 4 / 6 Podpod 0.0% 0 / 2 totaltotal 44.6% 21 / 47 CC 4 SCAR 22.6
CC
4
Cov
44%
scatter_marker
20.0
mode
2.0
BEGIN
1.0
CRAP 9.6
« Chart/GGPlot/Layout.pm ↑ Summary Chart/GGPlot/Scale/Discrete.pm »
1 package Chart::GGPlot::Backend::Plotly::Geom::Point;
2  
3 # ABSTRACT: Chart::GGPlot's Plotly implementation for Geom::Point
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 extends qw(Chart::GGPlot::Backend::Plotly::Geom::Path);
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_px to_rgb pdl_to_plotly);
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Chart::GGPlot::Util qw(ifelse);
Subroutine BEGIN: called CC=1 SCAR=0.0
15  
16 0 ▶sub mode {
Subroutine mode: not called CC=1 SCAR=6.9
Pod undocumented
17 0 return 'markers';
18 }
19  
20 0 ▶classmethod scatter_marker ($df, $params, @rest) {
Subroutine scatter_marker: not called CC=4 SCAR=30.0
Pod undocumented
Branch: 1 branch
BranchTrueFalseTotal
@_ < 3 and Function::Parameters::_croak('Too few arguments for classmethod scatter_marker (expected 3, got ' . @_ . ')') 0 0 0
21 0 my $color = to_rgb( $df->at('color') );
22 0 ▶ my $fill =
Branch: 1 branch
BranchTrueFalseTotal
$df->exists('fill') ? : 0 0 0
23 $df->exists('fill')
24 ? ifelse( $df->at('fill')->isbad, $color, to_rgb( $df->at('fill') ) )
25 : $color;
26 0 my $size = to_px( $df->at('size') );
27 0 $size->where($size < 2) .= 2;
28 0 my $opacity = $df->at('alpha')->setbadtoval(1);
29 0 my $stroke = to_px( $df->at('stroke') );
30  
31 0 my $use_webgl = $class->use_webgl($df);
32 0 ▶ my $plotly_trace_class =
Branch: 1 branch
BranchTrueFalseTotal
$use_webgl ? : 0 0 0
33 $use_webgl
34 ? 'Chart::Plotly::Trace::Scattergl'
35 : 'Chart::Plotly::Trace::Scatter';
36 0 my $plotly_marker_class = "${plotly_trace_class}::Marker";
37  
38 0 load $plotly_marker_class;
39  
40 0 return $plotly_marker_class->new(
41 color => pdl_to_plotly( $fill, true ),
42 size => pdl_to_plotly( $size, true ),
43 line => {
44 color => pdl_to_plotly( $color, true ),
45 width => pdl_to_plotly( $stroke, true ),
46 },
47  
48 # TODO: support scatter symbol
49 symbol => [ (0) x $df->at('size')->length ],
50 opacity => pdl_to_plotly( $opacity, true ),
51 );
52 1 }
53  
54 1 __PACKAGE__->meta->make_immutable;
55  
56 1 1;
57  
58 __END__
« Chart/GGPlot/Layout.pm ↑ Summary Chart/GGPlot/Scale/Discrete.pm »