Chart/Plotly/Trace/Histogram/Cumulative.pm untested

filter: Statementstmt 0.0% 0 / 37 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 65 CC 5 SCAR 29.7
CC
5
Cov
0%
TO_JSON
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 19.5
1 package Chart::Plotly::Trace::Histogram::Cumulative;
2 use Moose;
3 use MooseX::ExtraArgs;
4 use Moose::Util::TypeConstraints qw(enum union);
5 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
6 Moose::Util::TypeConstraints::type('PDL');
7 }
8  
9 our $VERSION = '0.042'; # VERSION
10  
11 # ABSTRACT: This attribute is one of the possible options for the trace histogram.
12  
13 sub TO_JSON {
14 my $self = shift;
15 my $extra_args = $self->extra_args // {};
16 my $meta = $self->meta;
17 my %hash = %$self;
18 for my $name ( sort keys %hash ) {
19 my $attr = $meta->get_attribute($name);
20 if ( defined $attr ) {
21 my $value = $hash{$name};
22 my $type = $attr->type_constraint;
23 if ( $type && $type->equals('Bool') ) {
24 $hash{$name} = $value ? \1 : \0;
25 }
26 }
27 }
28 %hash = ( %hash, %$extra_args );
29 delete $hash{'extra_args'};
30 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
31 $hash{type} = $self->type();
32 }
33 return \%hash;
34 }
35  
36 has currentbin => (
37 is => "rw",
38 isa => enum( [ "include", "exclude", "half" ] ),
39 documentation =>
40 "Only applies if cumulative is enabled. Sets whether the current bin is included, excluded, or has half of its value included in the current cumulative value. *include* is the default for compatibility with various other tools, however it introduces a half-bin bias to the results. *exclude* makes the opposite half-bin bias, and *half* removes it.",
41 );
42  
43 has direction => (
44 is => "rw",
45 isa => enum( [ "increasing", "decreasing" ] ),
46 documentation =>
47 "Only applies if cumulative is enabled. If *increasing* (default) we sum all prior bins, so the result increases from left to right. If *decreasing* we sum later bins so the result decreases from left to right.",
48 );
49  
50 has enabled => (
51 is => "rw",
52 isa => "Bool",
53 documentation =>
54 "If true, display the cumulative distribution by summing the binned values. Use the `direction` and `centralbin` attributes to tune the accumulation method. Note: in this mode, the *density* `histnorm` settings behave the same as their equivalents without *density*: ** and *density* both rise to the number of data points, and *probability* and *probability density* both rise to the number of sample points.",
55 );
56  
57 __PACKAGE__->meta->make_immutable();
58 1;
59  
60 __END__