| 1 |
|
| package Chart::GGPlot::Layer; |
| 2 |
|
| |
| 3 |
|
| # ABSTRACT: Chart::GGPlot layer |
| 4 |
|
| |
| 5 |
7 |
▶ | use Chart::GGPlot::Class qw(:pdl); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 6 |
7 |
▶ | use namespace::autoclean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 7 |
|
| |
| 8 |
7 |
| our $VERSION = '0.002003'; # VERSION |
| 9 |
|
| |
| 10 |
7 |
▶ | use List::AllUtils qw(pairgrep pairkeys pairmap); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 11 |
7 |
▶ | use Module::Load; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 12 |
7 |
▶ | use Data::Frame::Types qw(DataFrame); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 13 |
7 |
▶ | use Data::Frame::Util qw(is_discrete); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 14 |
7 |
▶ | use Types::Standard qw(Bool Defined Enum HashRef InstanceOf Maybe); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 15 |
|
| |
| 16 |
7 |
▶ | use Chart::GGPlot::Types qw(:all); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 17 |
7 |
▶ | use Chart::GGPlot::Aes; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 18 |
7 |
▶ | use Chart::GGPlot::Stat::Functions qw(:all); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 19 |
7 |
▶ | use Chart::GGPlot::Util qw(:all); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
|
| 20 |
|
| |
| 21 |
|
| |
| 22 |
7 |
| has data => ( |
| 23 |
|
| is => 'ro', |
| 24 |
|
| isa => Maybe [DataFrame], |
| 25 |
|
| ); |
| 26 |
7 |
| has mapping => ( |
| 27 |
|
| is => 'rw', |
| 28 |
|
| coerce => 1, |
| 29 |
|
| isa => GGParams, |
| 30 |
|
| ); |
| 31 |
7 |
| has geom => ( is => 'ro', required => 1 ); |
| 32 |
7 |
| has geom_params => ( |
| 33 |
|
| is => 'rw', |
| 34 |
|
| isa => GGParams, |
| 35 |
|
| coerce => 1, |
| 36 |
|
| ); |
| 37 |
7 |
| has stat => ( is => 'ro', required => 1 ); |
| 38 |
7 |
| has stat_params => ( |
| 39 |
|
| is => 'rw', |
| 40 |
|
| isa => GGParams, |
| 41 |
|
| coerce => 1, |
| 42 |
|
| ); |
| 43 |
7 |
| has aes_params => ( |
| 44 |
|
| is => 'rw', |
| 45 |
|
| isa => AesMapping, |
| 46 |
|
| coerce => 1, |
| 47 |
|
| ); |
| 48 |
7 |
| has position => ( is => 'ro', required => 1 ); |
| 49 |
0 |
▶ | has inherit_aes => ( is => 'ro', default => sub { false } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=1.2
|
| 50 |
|
| |
| 51 |
|
| |
| 52 |
7 |
| has show_legend => ( is => 'ro' ); |
| 53 |
|
| |
| 54 |
10 |
▶ | around BUILDARGS( $orig, $class : @rest ) { |
|
Subroutine
:around: called CC=2 SCAR=7.0
Branch: 1 branch
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for around BUILDARGS (expected 2, got ' . @_ . ')') |
0 |
10 |
10 |
|
| 55 |
10 |
| my %params = @rest; |
| 56 |
10 |
| return $class->$orig( %{ $class->_layer(%params) } ); |
| 57 |
7 |
| }; |
| 58 |
|
| |
| 59 |
32 |
▶ | classmethod _find_subclass ($super, $name) { |
|
Subroutine
_find_subclass: called CC=4 SCAR=14.3
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 3 and Function::Parameters::_croak('Too few arguments for classmethod _find_subclass (expected 3, got ' . @_ . ')') |
0 |
32 |
32 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for classmethod _find_subclass (expected 3, got ' . @_ . ')') |
0 |
32 |
32 |
|
| 60 |
|
| return ( |
| 61 |
|
| $name =~ /^Chart::GGPlot::/ |
| 62 |
|
| ? $name |
| 63 |
|
| : "Chart::GGPlot::${super}::" |
| 64 |
32 |
▶ | . join( '', map { ucfirst($_) } split( /_/, $name ) ) |
Branch: 1 branch
| Branch | True | False | Total |
| $name =~ /^Chart::GGPlot::/u ? : |
0 |
32 |
32 |
|
| 65 |
|
| ); |
| 66 |
7 |
| } |
| 67 |
|
| |
| 68 |
10 |
▶ | classmethod _layer (Defined :$geom, Defined :$stat, |
|
Subroutine
_layer: called CC=25 SCAR=36.7
|
| 69 |
|
| :$data = undef, :$mapping = undef, |
| 70 |
|
| Defined :$position, |
| 71 |
|
| :$params = { na_rm => false }, |
| 72 |
|
| :$inherit_aes = true, :$check_aes = true, |
| 73 |
|
| :$check_param = true, :$show_legend = NA |
| 74 |
10 |
▶ | ) { |
Branch: 14 branches
| Branch | True | False | Total |
| @_ < 7 and Function::Parameters::_croak('Too few arguments for classmethod _layer (expected 7, got ' . @_ . ')') |
0 |
10 |
10 |
| @_ > 1 and (@_ - 1) % 2 and Function::Parameters::_croak("Odd number of paired arguments for classmethod _layer") |
0 |
10 |
10 |
| exists ${__rest}{'geom'} ? : |
10 |
0 |
10 |
| exists ${__rest}{'stat'} ? : |
10 |
0 |
10 |
| exists ${__rest}{'position'} ? : |
10 |
0 |
10 |
| exists ${__rest}{'params'} ? : |
10 |
0 |
10 |
| exists ${__rest}{'inherit_aes'} ? : |
10 |
0 |
10 |
| exists ${__rest}{'check_aes'} ? : |
0 |
10 |
10 |
| exists ${__rest}{'check_param'} ? : |
0 |
10 |
10 |
| exists ${__rest}{'show_legend'} ? : |
10 |
0 |
10 |
| keys %{__rest} and Function::Parameters::_croak('In classmethod _layer: no such named parameter: ' . join(", ", sort(keys %{__rest}))) |
0 |
10 |
10 |
| defined $geom or Function::Parameters::_croak('In classmethod _layer: parameter 1 ($geom): ' . ${my $v = bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","moose_type" => bless( {"Types::TypeTiny::to_TypeTiny" => {},"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_44; use warnings; use strict; do { 1 };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; 1;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; '1';},"name" => "Any","package_defined_in" => "Moose::Util::TypeConstraints::Builtins"}, 'Moose::Meta::TypeConstraint' ),"name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","moose_type" => bless( {"Types::TypeTiny::to_TypeTiny" => {},"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_47; use warnings; use strict; do { defined $_[0] };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; defined $_;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; 'defined(' . $_[1] . ')';},"name" => "Defined","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => bless( {"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_45; use warnings; use strict; do { 1 };},"constraint" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; 1;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; '1';},"name" => "Item","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => {}}, 'Moose::Meta::TypeConstraint' )}, 'Moose::Meta::TypeConstraint' ),"name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"complementary_type"};$v->{"complementary_type"}{"compiled_type_constraint"} = $v->{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"complementary_type"} = $v;$v->{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"complementary_type"}{"parent"};$v->{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"complementary_type"}{"parent"}{"parent"};$v->{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"complementary_type"}{"parent"}{"constraint"};$v->{"complementary_type"}{"parent"}{"parent"}{"moose_type"}{"Types::TypeTiny::to_TypeTiny"} = $v->{"complementary_type"}{"parent"}{"parent"};$v->{"moose_type"}{"Types::TypeTiny::to_TypeTiny"} = $v;$v->{"moose_type"}{"parent"}{"parent"} = $v->{"complementary_type"}{"parent"}{"parent"}{"moose_type"};$v->{"parent"} = $v->{"complementary_type"}{"parent"}; \$v}->get_message($geom)) |
10 |
0 |
10 |
| defined $stat or Function::Parameters::_croak('In classmethod _layer: parameter 2 ($stat): ' . ${my $v = bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","moose_type" => bless( {"Types::TypeTiny::to_TypeTiny" => {},"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_44; use warnings; use strict; do { 1 };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; 1;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; '1';},"name" => "Any","package_defined_in" => "Moose::Util::TypeConstraints::Builtins"}, 'Moose::Meta::TypeConstraint' ),"name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","moose_type" => bless( {"Types::TypeTiny::to_TypeTiny" => {},"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_47; use warnings; use strict; do { defined $_[0] };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; defined $_;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; 'defined(' . $_[1] . ')';},"name" => "Defined","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => bless( {"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_45; use warnings; use strict; do { 1 };},"constraint" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; 1;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; '1';},"name" => "Item","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => {}}, 'Moose::Meta::TypeConstraint' )}, 'Moose::Meta::TypeConstraint' ),"name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"complementary_type"};$v->{"complementary_type"}{"compiled_type_constraint"} = $v->{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"complementary_type"} = $v;$v->{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"complementary_type"}{"parent"};$v->{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"complementary_type"}{"parent"}{"parent"};$v->{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"complementary_type"}{"parent"}{"constraint"};$v->{"complementary_type"}{"parent"}{"parent"}{"moose_type"}{"Types::TypeTiny::to_TypeTiny"} = $v->{"complementary_type"}{"parent"}{"parent"};$v->{"moose_type"}{"Types::TypeTiny::to_TypeTiny"} = $v;$v->{"moose_type"}{"parent"}{"parent"} = $v->{"complementary_type"}{"parent"}{"parent"}{"moose_type"};$v->{"parent"} = $v->{"complementary_type"}{"parent"}; \$v}->get_message($stat)) |
10 |
0 |
10 |
| defined $position or Function::Parameters::_croak('In classmethod _layer: parameter 3 ($position): ' . ${my $v = bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; defined $_[0] or _failed_check(7, 'Defined', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Defined","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; defined $_[0] and _failed_check(6, 'Undef', $_[0], 'exception_class', 'Error::TypeTiny::Assertion'); $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Undef","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complementary_type" => {},"constraint" => sub { package Types::Standard; no warnings; use strict; not defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 254,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Undef","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "!defined($_[1])";},"library" => "Types::Standard","name" => "Undef","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => sub ;,"display_name" => "to_Item","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"constraint" => sub { package Type::Tiny; use warnings; use strict; !0;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 226,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Item","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","name" => "Item","parent" => bless( {"_is_core" => 1,"_overload_coderef" => sub { package Type::Tiny; BEGIN {${^WARNING_BITS} = "\x10\x01\x00\x00\x00\x50\x04\x00\x00\x00\x00\x00\x01\x40\x05\x45\x55\x15\x55\x55\x01\x00\x00"} use strict; '???'; $_[0];},"_overrides_assert_return" => !!0,"coercion" => bless( {"_compiled_type_constraint_check" => do{my $o},"display_name" => "to_Any","frozen" => 1,"name" => "__ANON__","type_coercion_map" => [],"type_constraint" => {}}, 'Type::Coercion' ),"compiled_type_constraint" => do{my $o},"complement_name" => "None","constraint" => do{my $o},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 220,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Any","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; '!!1';},"library" => "Types::Standard","moose_type" => bless( {"Types::TypeTiny::to_TypeTiny" => {},"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_44; use warnings; use strict; do { 1 };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; 1;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; '1';},"name" => "Any","package_defined_in" => "Moose::Util::TypeConstraints::Builtins"}, 'Moose::Meta::TypeConstraint' ),"name" => "Any","type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 1}, 'Type::Tiny' ),"uniq" => 2}, 'Type::Tiny' ),"type_default" => sub { package Types::Standard; no warnings; use strict; return undef;},"uniq" => 6}, 'Type::Tiny' ),"constraint" => sub { package Types::Standard; no warnings; use strict; defined $_;},"definition_context" => {"file" => "/usr/local/lib/perl5/site_perl/5.44.0/Types/Standard.pm","line" => 262,"package" => "Types::Standard"},"deprecated" => !!0,"display_name" => "Defined","exception_class" => "Error::TypeTiny::Assertion","inlined" => sub { package Types::Standard; no warnings; use strict; "defined($_[1])";},"library" => "Types::Standard","moose_type" => bless( {"Types::TypeTiny::to_TypeTiny" => {},"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_47; use warnings; use strict; do { defined $_[0] };},"constraint" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; defined $_;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; 'defined(' . $_[1] . ')';},"name" => "Defined","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => bless( {"_default_message" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; my $value = shift(); my $can_partialdump = &try(sub { require Devel::PartialDump; 'Devel::PartialDump'->VERSION(0.14); 1; } ); if ($can_partialdump) { $value = 'Devel::PartialDump'->new->dump($value); } else { $value = defined $value ? overload::StrVal($value) : 'undef'; } return q[Validation failed for '] . $name . "' with value $value";},"compiled_type_constraint" => sub { package Eval::Closure::Sandbox_45; use warnings; use strict; do { 1 };},"constraint" => sub { package Moose::Meta::TypeConstraint; use warnings; use strict; 1;},"inline_environment" => {},"inlined" => sub { package Moose::Util::TypeConstraints::Builtins; use warnings; use strict; '1';},"name" => "Item","package_defined_in" => "Moose::Util::TypeConstraints::Builtins","parent" => {}}, 'Moose::Meta::TypeConstraint' )}, 'Moose::Meta::TypeConstraint' ),"name" => "Defined","parent" => {},"uniq" => 7}, 'Type::Tiny' );$v->{"coercion"}{"type_constraint"} = $v;$v->{"compiled_type_constraint"} = $v->{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"coercion"}{"type_constraint"} = $v->{"complementary_type"};$v->{"complementary_type"}{"compiled_type_constraint"} = $v->{"complementary_type"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"complementary_type"} = $v;$v->{"complementary_type"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"complementary_type"}{"parent"};$v->{"complementary_type"}{"parent"}{"compiled_type_constraint"} = $v->{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"} = $v->{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"parent"}{"parent"}{"coercion"}{"type_constraint"} = $v->{"complementary_type"}{"parent"}{"parent"};$v->{"complementary_type"}{"parent"}{"parent"}{"compiled_type_constraint"} = $v->{"complementary_type"}{"parent"}{"coercion"}{"_compiled_type_constraint_check"};$v->{"complementary_type"}{"parent"}{"parent"}{"constraint"} = $v->{"complementary_type"}{"parent"}{"constraint"};$v->{"complementary_type"}{"parent"}{"parent"}{"moose_type"}{"Types::TypeTiny::to_TypeTiny"} = $v->{"complementary_type"}{"parent"}{"parent"};$v->{"moose_type"}{"Types::TypeTiny::to_TypeTiny"} = $v;$v->{"moose_type"}{"parent"}{"parent"} = $v->{"complementary_type"}{"parent"}{"parent"}{"moose_type"};$v->{"parent"} = $v->{"complementary_type"}{"parent"}; \$v}->get_message($position)) |
10 |
0 |
10 |
MC/DC0%0/2
@_ > 1 and (@_ - 1) % 2
@_ > 1
(@_ - 1) % 2
Truth table33%1/3
A and B
A= @_ > 1B= (@_ - 1) % 2
|
| 75 |
10 |
▶ | $mapping //= Chart::GGPlot::Aes->new(); |
Condition66%2/3
$mapping //= "Chart::GGPlot::Aes"->new
MC/DC0%0/2
$mapping //= "Chart::GGPlot::Aes"->new
$mapping
"Chart::GGPlot::Aes"->new
Truth table66%2/3
A //= B
A= $mappingB= "Chart::GGPlot::Aes"->new
|
| 76 |
10 |
▶ | unless ( defined $params->at("na_rm") ) { |
Branch: 1 branch
| Branch | True | False | Total |
| unless (defined $params->at("na_rm")) |
0 |
10 |
10 |
|
| 77 |
0 |
| $params->set( "na_rm", "nan" ); |
| 78 |
|
| } |
| 79 |
|
| |
| 80 |
30 |
▶ | my $find_subclass = fun( $super, $x ) { |
|
Subroutine
__ANON__: called CC=4 SCAR=14.6
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for fun (anon) (expected 2, got ' . @_ . ')') |
0 |
30 |
30 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for fun (anon) (expected 2, got ' . @_ . ')') |
0 |
30 |
30 |
|
| 81 |
30 |
▶ | unless ( Ref::Util::is_ref($x) ) { # $x is a class name |
Branch: 1 branch
| Branch | True | False | Total |
| unless (Ref::Util::XS::is_ref($x)) |
30 |
0 |
30 |
|
| 82 |
30 |
| my $subclass = $class->_find_subclass( $super, $x ); |
| 83 |
30 |
| load $subclass; |
| 84 |
30 |
| return $subclass->new(); |
| 85 |
|
| } |
| 86 |
0 |
| return $x; |
| 87 |
10 |
| }; |
| 88 |
10 |
| $geom = $find_subclass->( 'Geom', $geom ); |
| 89 |
10 |
| $stat = $find_subclass->( 'Stat', $stat ); |
| 90 |
10 |
| $position = $find_subclass->( 'Position', $position ); |
| 91 |
|
| |
| 92 |
|
| # Split up params between aesthetics, geom, and stat |
| 93 |
10 |
| $params = Chart::GGPlot::Aes->new( $params->flatten ); |
| 94 |
30 |
▶ | my $select_params = sub { |
|
Subroutine
__ANON__: called CC=2 SCAR=6.9
|
| 95 |
30 |
| my $names = shift; |
| 96 |
|
| my %selected = |
| 97 |
30 |
▶ | map { $params->exists($_) ? ( $_ => $params->at($_) ) : () } @$names; |
Branch: 1 branch
| Branch | True | False | Total |
| $params->exists($_) ? : |
35 |
100 |
135 |
|
| 98 |
30 |
| return \%selected; |
| 99 |
10 |
| }; |
| 100 |
10 |
▶ | my $aes_params = $geom ? &$select_params( $geom->aesthetics ) : {}; |
Branch: 1 branch
| Branch | True | False | Total |
| $geom ? : |
10 |
0 |
10 |
|
| 101 |
10 |
▶ | my $geom_params = $geom ? &$select_params( $geom->parameters(true) ) : {}; |
Branch: 1 branch
| Branch | True | False | Total |
| $geom ? : |
10 |
0 |
10 |
|
| 102 |
10 |
▶ | my $stat_params = $stat ? &$select_params( $stat->parameters(true) ) : {}; |
Branch: 1 branch
| Branch | True | False | Total |
| $stat ? : |
10 |
0 |
10 |
|
| 103 |
|
| |
| 104 |
|
| # Warn about extra params and aesthetics |
| 105 |
|
| |
| 106 |
|
| my $all = [ $aes_params, $geom_params, $stat_params ] |
| 107 |
10 |
▶ | ->map( sub { $_->keys->flatten } ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
|
| 108 |
10 |
| my $extra_param = $params->keys->setdiff($all); |
| 109 |
10 |
▶ | if ( $check_param and not $extra_param->isempty ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($check_param and not $extra_param->isempty) |
0 |
10 |
10 |
Condition33%1/3
$check_param and not $extra_param->isempty
MC/DC0%0/2
$check_param and not $extra_param->isempty
$check_param
not $extra_param->isempty
Truth table33%1/3
A and not(B)
A= $check_paramB= not $extra_param->isempty
|
| 110 |
0 |
| carp( "Ignoring unknown parameters: " . join( ", ", @$extra_param ) ); |
| 111 |
|
| } |
| 112 |
|
| |
| 113 |
|
| my %seen_aes = |
| 114 |
10 |
| map { $_ => 1 } ( @{ $geom->aesthetics }, @{ $stat->aesthetics } ); |
| 115 |
|
| my @extra_aes = |
| 116 |
5 |
| grep { !exists $seen_aes{$_} } |
| 117 |
10 |
| grep { defined $mapping->at($_) } @{ $mapping->keys }; |
| 118 |
|
| |
| 119 |
10 |
▶ | if ( $check_aes and @extra_aes ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($check_aes and @extra_aes) |
0 |
10 |
10 |
Condition33%1/3
$check_aes and @extra_aes
MC/DC0%0/2
$check_aes and @extra_aes
$check_aes
@extra_aes
Truth table33%1/3
A and B
A= $check_aesB= @extra_aes
|
| 120 |
0 |
| carp( "Ignoring unknown aesthetics: " . join( ", ", @extra_aes ) ); |
| 121 |
|
| } |
| 122 |
|
| |
| 123 |
|
| return { |
| 124 |
10 |
| geom => $geom, |
| 125 |
|
| stat => $stat, |
| 126 |
|
| data => $data, |
| 127 |
|
| mapping => $mapping, |
| 128 |
|
| position => $position, |
| 129 |
|
| inherit_aes => $inherit_aes, |
| 130 |
|
| show_legend => $show_legend, |
| 131 |
|
| geom_params => $geom_params, |
| 132 |
|
| stat_params => $stat_params, |
| 133 |
|
| aes_params => $aes_params, |
| 134 |
|
| }; |
| 135 |
7 |
| } |
| 136 |
|
| |
| 137 |
|
| |
| 138 |
0 |
▶ | method string () { |
|
Subroutine
string: not called CC=4 SCAR=30.0
Pod
documented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 1 and Function::Parameters::_croak('Too few arguments for method string (expected 1, got ' . @_ . ')') |
0 |
0 |
0 |
| @_ > 1 and Function::Parameters::_croak('Too many arguments for method string (expected 1, got ' . @_ . ')') |
0 |
0 |
0 |
|
| 139 |
0 |
| my $s = ''; |
| 140 |
0 |
▶ | if ( $self->mapping ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($self->mapping) |
0 |
0 |
0 |
|
| 141 |
0 |
| $s .= sprintf( "mapping: %s\n", clist( $self->mapping ) ); |
| 142 |
|
| } |
| 143 |
|
| $s .= |
| 144 |
0 |
| sprintf( "%s: %s\n", ref( $self->geom ), clist( $self->geom_params ) ); |
| 145 |
0 |
| $s .= |
| 146 |
|
| sprintf( "%s: %s\n", ref( $self->stat ), clist( $self->stat_params ) ); |
| 147 |
0 |
| $s .= sprintf( "%s\n", ref( $self->position ) ); |
| 148 |
0 |
| return $s; |
| 149 |
7 |
| } |
| 150 |
|
| |
| 151 |
6 |
▶ | method layer_data ($plot_data) { |
|
Subroutine
layer_data: called CC=5 SCAR=20.9
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for method layer_data (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method layer_data (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 152 |
6 |
▶ | return $plot_data unless ( defined $self->data ); |
Branch: 1 branch
| Branch | True | False | Total |
| unless defined $self->data |
6 |
0 |
6 |
|
| 153 |
|
| |
| 154 |
0 |
| my $data = call_if_coderef( $self->data, $plot_data ); |
| 155 |
0 |
▶ | unless ( $data->$_DOES('Data::Frame') ) { |
Branch: 1 branch
| Branch | True | False | Total |
| unless ($data->$Chart::GGPlot::Layer::_DOES("Data::Frame")) |
0 |
0 |
0 |
|
| 156 |
0 |
| die("Data function must return a dataframe object"); |
| 157 |
|
| } |
| 158 |
0 |
| return $data; |
| 159 |
7 |
| } |
| 160 |
|
| |
| 161 |
6 |
▶ | method compute_aesthetics ( $data, $plot ) { |
|
Subroutine
compute_aesthetics: called CC=9 SCAR=25.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 3 and Function::Parameters::_croak('Too few arguments for method compute_aesthetics (expected 3, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method compute_aesthetics (expected 3, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 162 |
6 |
▶ | my $aesthetics = |
Branch: 1 branch
| Branch | True | False | Total |
| $self->inherit_aes ? : |
6 |
0 |
6 |
|
| 163 |
|
| $self->inherit_aes |
| 164 |
|
| ? $self->mapping->defaults( $plot->mapping ) |
| 165 |
|
| : $self->mapping; |
| 166 |
|
| |
| 167 |
|
| # Drop aesthetics that are set or calculated |
| 168 |
6 |
| my $set = $aesthetics->keys->intersect( $self->aes_params->keys ); |
| 169 |
6 |
| my $calculated = $self->calculated_aes($aesthetics); |
| 170 |
|
| |
| 171 |
|
| # !set and !calculated |
| 172 |
6 |
| $aesthetics = $aesthetics->hslice( |
| 173 |
|
| $aesthetics->keys->setdiff( $set->union($calculated) ) ); |
| 174 |
|
| |
| 175 |
|
| # Override grouping if set in layer |
| 176 |
6 |
▶ | if ( $self->geom_params->exists('group') ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($self->geom_params->exists("group")) |
0 |
6 |
6 |
|
| 177 |
0 |
| $aesthetics->set( 'group', $self->aes_params->at('group') ); |
| 178 |
|
| } |
| 179 |
|
| |
| 180 |
6 |
| $plot->scales->add_defaults( $data, $aesthetics ); |
| 181 |
|
| |
| 182 |
|
| # Evaluate and check aesthetics |
| 183 |
|
| my $evaled = Data::Frame->new( columns => |
| 184 |
6 |
▶ | [ pairmap { $a => $data->eval_tidy($b) } ( $aesthetics->flatten ) ] ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
|
| 185 |
|
| |
| 186 |
|
| # If there is no data, look at longest evaluated aesthetic. |
| 187 |
|
| my $n = |
| 188 |
|
| $data->nrow |
| 189 |
|
| || $evaled->nrow |
| 190 |
|
| || List::AllUtils::max( |
| 191 |
0 |
▶ | @{ $evaled->names->map( sub { $evaled->at($_)->length } ) } ); |
|
Subroutine
__ANON__: not called CC=1 SCAR=2.6
Condition33%2/6
$data->nrow || $evaled->nrow || &List::AllUtils::max(@{$evaled->names->map(sub {
$evaled->at($_)->length;
}
);})
$data->nrow or $evaled->nrow
MC/DC0%0/3
$data->nrow || $evaled->nrow || &List::AllUtils::max(@{$evaled->names->map(sub {
$evaled->at($_)->length;
}
);})
$data->nrow
$evaled->nrow
&List::AllUtils::max(@{$evaled->names->map(sub {
$evaled->at($_)->length;
}
);})
Truth table25%1/4
A or B || C
A= $data->nrowB= $evaled->nrowC= &List::AllUtils::max(@{$evaled->names->map(sub {
$evaled->at($_)->length;
}
);})
| A | B | C | result |
| 1 | X | X | 1 |
| 0 | 1 | X | 1 |
| 0 | 0 | 1 | 1 |
| 0 | 0 | 0 | 0 |
|
| 192 |
6 |
| Chart::GGPlot::Aes->check_aesthetics( $evaled, $n ); |
| 193 |
|
| |
| 194 |
|
| # Set special group and panel vars |
| 195 |
6 |
▶ | $evaled->set( 'PANEL', ( $data->isempty and $n > 0 ) |
Branch: 1 branch
| Branch | True | False | Total |
| $data->isempty && $n > 0 ? : |
0 |
6 |
6 |
Condition33%1/3
$data->isempty and $n > 0
MC/DC0%0/2
$data->isempty and $n > 0
$data->isempty
$n > 0
Truth table33%1/3
A and B
A= $data->isemptyB= $n > 0
|
| 196 |
|
| ? pdl(0) |
| 197 |
|
| : $data->at('PANEL') ); |
| 198 |
6 |
| $evaled = $self->add_group($evaled); |
| 199 |
|
| |
| 200 |
6 |
| return $evaled; |
| 201 |
7 |
| } |
| 202 |
|
| |
| 203 |
6 |
▶ | method compute_statistic ( $data, $layout ) { |
|
Subroutine
compute_statistic: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 3 and Function::Parameters::_croak('Too few arguments for method compute_statistic (expected 3, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method compute_statistic (expected 3, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 204 |
6 |
▶ | return Data::Frame->new() if ( $data->isempty ); |
Branch: 1 branch
| Branch | True | False | Total |
| if $data->isempty |
0 |
6 |
6 |
|
| 205 |
|
| |
| 206 |
6 |
| my $params = $self->stat->setup_params( $data, $self->stat_params ); |
| 207 |
6 |
| my $data = $self->stat->setup_data( $data, $params ); |
| 208 |
6 |
| return $self->stat->compute_layer( $data, $params, $layout ); |
| 209 |
7 |
| } |
| 210 |
|
| |
| 211 |
6 |
▶ | method map_statistic ( $data, $plot ) { |
|
Subroutine
map_statistic: called CC=7 SCAR=20.0
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 3 and Function::Parameters::_croak('Too few arguments for method map_statistic (expected 3, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method map_statistic (expected 3, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 212 |
6 |
▶ | return Data::Frame->new() if ( $data->isempty ); |
Branch: 1 branch
| Branch | True | False | Total |
| if $data->isempty |
0 |
6 |
6 |
|
| 213 |
|
| |
| 214 |
|
| # Assemble aesthetics from layer, plot and stat mappings |
| 215 |
6 |
| my $aesthetics = $self->mapping; |
| 216 |
6 |
▶ | if ( $self->inherit_aes ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($self->inherit_aes) |
6 |
0 |
6 |
|
| 217 |
6 |
| $aesthetics = $aesthetics->defaults( $plot->mapping ); |
| 218 |
|
| } |
| 219 |
|
| |
| 220 |
6 |
| $aesthetics = $aesthetics->defaults( $self->stat->default_aes ); |
| 221 |
|
| #$aesthetics = compact($aesthetics); |
| 222 |
|
| |
| 223 |
6 |
| my $new = $aesthetics->hslice( $self->calculated_aes($aesthetics) ); |
| 224 |
6 |
▶ | return $data if ( $new->isempty ); |
Branch: 1 branch
| Branch | True | False | Total |
| if $new->isempty |
5 |
1 |
6 |
|
| 225 |
|
| |
| 226 |
|
| my $stat_data = |
| 227 |
|
| Data::Frame->new( |
| 228 |
1 |
▶ | columns => [ pairmap { $a => $data->eval_tidy($b) } $new->flatten ] ); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
|
| 229 |
1 |
| $plot->scales->add_defaults( $data, $new ); |
| 230 |
|
| |
| 231 |
|
| # Transform the values, if the scale say it's ok |
| 232 |
1 |
▶ | if ( $self->stat->retransform ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($self->stat->retransform) |
0 |
1 |
1 |
|
| 233 |
0 |
| $stat_data = $plot->scales->transform_df($stat_data); |
| 234 |
|
| } |
| 235 |
|
| |
| 236 |
1 |
| return $data->merge($stat_data); |
| 237 |
7 |
| } |
| 238 |
|
| |
| 239 |
6 |
▶ | method compute_geom_1($data) { |
|
Subroutine
compute_geom_1: called CC=4 SCAR=14.0
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for method compute_geom_1 (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method compute_geom_1 (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 240 |
6 |
▶ | return Data::Frame->new() if ( $data->isempty ); |
Branch: 1 branch
| Branch | True | False | Total |
| if $data->isempty |
0 |
6 |
6 |
|
| 241 |
|
| |
| 242 |
|
| $self->geom->check_required_aes( |
| 243 |
6 |
| [ @{ $data->names }, @{ $self->aes_params->names } ] ); |
| 244 |
|
| |
| 245 |
6 |
| my $geom_params = $self->geom_params->merge( $self->aes_params ); |
| 246 |
6 |
| $self->validate_params($geom_params); |
| 247 |
6 |
| return $self->geom->setup_data( $data, $geom_params ); |
| 248 |
7 |
| } |
| 249 |
|
| |
| 250 |
6 |
▶ | method compute_position ( $data, $layout ) { |
|
Subroutine
compute_position: called CC=4 SCAR=14.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 3 and Function::Parameters::_croak('Too few arguments for method compute_position (expected 3, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 3 and Function::Parameters::_croak('Too many arguments for method compute_position (expected 3, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 251 |
6 |
▶ | return Data::Frame->new() if ( $data->isempty ); |
Branch: 1 branch
| Branch | True | False | Total |
| if $data->isempty |
0 |
6 |
6 |
|
| 252 |
|
| |
| 253 |
6 |
| my $params = $self->position->setup_params($data); |
| 254 |
6 |
| $data = $self->position->setup_data( $data, $params ); |
| 255 |
6 |
| return $self->position->compute_layer( $data, $params, $layout ); |
| 256 |
7 |
| } |
| 257 |
|
| |
| 258 |
|
| # Combine aesthetics, defaults, and params |
| 259 |
6 |
▶ | method compute_geom_2 ($data) { |
|
Subroutine
compute_geom_2: called CC=4 SCAR=14.3
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for method compute_geom_2 (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method compute_geom_2 (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 260 |
6 |
▶ | return Data::Frame->new() if ( $data->isempty ); |
Branch: 1 branch
| Branch | True | False | Total |
| if $data->isempty |
0 |
6 |
6 |
|
| 261 |
6 |
| return $self->geom->use_defaults( $data, $self->aes_params ); |
| 262 |
7 |
| } |
| 263 |
|
| |
| 264 |
6 |
▶ | method finish_statistics ($data) { |
|
Subroutine
finish_statistics: called CC=3 SCAR=11.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for method finish_statistics (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method finish_statistics (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 265 |
6 |
| $self->stat->finish_layer( $data, $self->stat_params ); |
| 266 |
7 |
| } |
| 267 |
|
| |
| 268 |
|
| # return an arrayref of keys. |
| 269 |
12 |
▶ | method calculated_aes ($aesthetics) { |
|
Subroutine
calculated_aes: called CC=3 SCAR=11.3
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for method calculated_aes (expected 2, got ' . @_ . ')') |
0 |
12 |
12 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for method calculated_aes (expected 2, got ' . @_ . ')') |
0 |
12 |
12 |
|
| 270 |
|
| # TODO: better to use PPR to make sure the function is "stat"? |
| 271 |
|
| return [ |
| 272 |
|
| pairkeys( |
| 273 |
30 |
▶ | pairgrep { |
|
Subroutine
__ANON__: called CC=2 SCAR=7.6
|
| 274 |
30 |
▶ | $b->$_DOES('Eval::Quosure') and $b->expr =~ /^\s*stat\s*\(/; |
Branch: 1 branch
| Branch | True | False | Total |
| $b->$Chart::GGPlot::Layer::_DOES("Eval::Quosure") and $b->expr =~ /^\s*stat\s*\(/u |
30 |
0 |
30 |
|
| 275 |
|
| } |
| 276 |
12 |
| $aesthetics->flatten |
| 277 |
|
| ) |
| 278 |
|
| ]; |
| 279 |
7 |
| } |
| 280 |
|
| |
| 281 |
6 |
▶ | classmethod add_group ($data) { |
|
Subroutine
add_group: called CC=6 SCAR=18.0
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for classmethod add_group (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for classmethod add_group (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 282 |
6 |
▶ | return $data if $data->isempty; |
Branch: 1 branch
| Branch | True | False | Total |
| if $data->isempty |
0 |
6 |
6 |
|
| 283 |
|
| |
| 284 |
6 |
▶ | if ( $data->exists('group') ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($data->exists('group')) { } |
1 |
5 |
6 |
|
| 285 |
1 |
| my $group = $data->at('group'); |
| 286 |
1 |
| $data->set( 'group', $group->id ); |
| 287 |
1 |
| $data->set( 'group_raw', $group ); |
| 288 |
|
| } |
| 289 |
|
| else { |
| 290 |
|
| my $discrete_columns = $data->names->grep( |
| 291 |
15 |
▶ | sub { |
|
Subroutine
__ANON__: called CC=3 SCAR=11.1
|
| 292 |
15 |
▶ | $_ ne 'label' |
Branch: 1 branch
| Branch | True | False | Total |
| $_ ne "label" and $_ ne "PANEL" and is_discrete($data->at($_)) |
10 |
5 |
15 |
Condition66%2/3
$_ ne "label" and $_ ne "PANEL"
MC/DC50%1/2
$_ ne "label" and $_ ne "PANEL"
$_ ne "label"
$_ ne "PANEL"
Truth table66%2/3
A and B
A= $_ ne "label"B= $_ ne "PANEL"
|
| 293 |
|
| and $_ ne 'PANEL' |
| 294 |
|
| and is_discrete( $data->at($_) ); |
| 295 |
|
| } |
| 296 |
5 |
| ); |
| 297 |
5 |
▶ | if ( $discrete_columns->length ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if ($discrete_columns->length) { } |
3 |
2 |
5 |
|
| 298 |
3 |
| $data->set( 'group', $data->select_columns($discrete_columns)->id ); |
| 299 |
|
| } |
| 300 |
|
| else { |
| 301 |
2 |
| $data->set( 'group', pdl(0) ); |
| 302 |
|
| } |
| 303 |
|
| } |
| 304 |
6 |
| return $data; |
| 305 |
7 |
| } |
| 306 |
|
| |
| 307 |
|
| # For type validation on aes and params |
| 308 |
7 |
| my $aes2type = { |
| 309 |
|
| hjust => HJust, |
| 310 |
|
| vjust => VJust, |
| 311 |
|
| }; |
| 312 |
|
| |
| 313 |
6 |
▶ | classmethod validate_params($params) { |
|
Subroutine
validate_params: called CC=6 SCAR=21.2
Pod
undocumented
Branch: 2 branches
| Branch | True | False | Total |
| @_ < 2 and Function::Parameters::_croak('Too few arguments for classmethod validate_params (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
| @_ > 2 and Function::Parameters::_croak('Too many arguments for classmethod validate_params (expected 2, got ' . @_ . ')') |
0 |
6 |
6 |
|
| 314 |
6 |
| for my $k ( @{ $params->keys } ) { |
| 315 |
16 |
| my $type = $aes2type->{$k}; |
| 316 |
16 |
▶ | next unless $type; |
Branch: 1 branch
| Branch | True | False | Total |
| unless $type |
16 |
0 |
16 |
|
| 317 |
0 |
| my $val = $params->at($k); |
| 318 |
0 |
▶ | if ( my $msg = $type->validate($val) ) { |
Branch: 1 branch
| Branch | True | False | Total |
| if (my $msg = $type->validate($val)) |
0 |
0 |
0 |
|
| 319 |
0 |
| die "Validation failed on parameter \"$k\": $msg"; |
| 320 |
|
| } |
| 321 |
|
| } |
| 322 |
7 |
| } |
| 323 |
|
| |
| 324 |
7 |
| __PACKAGE__->meta->make_immutable; |
| 325 |
|
| |
| 326 |
7 |
| 1; |
| 327 |
|
| |
| 328 |
|
| __END__ |