Chart/Plotly/Trace/Indicator/Gauge.pm untested

filter: Statementstmt 0.0% 0 / 53 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 8 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 85 CC 5 SCAR 26.1
CC
5
Cov
0%
TO_JSON
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 13.7
1 package Chart::Plotly::Trace::Indicator::Gauge;
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 use Chart::Plotly::Trace::Indicator::Gauge::Axis;
10 use Chart::Plotly::Trace::Indicator::Gauge::Bar;
11 use Chart::Plotly::Trace::Indicator::Gauge::Step;
12 use Chart::Plotly::Trace::Indicator::Gauge::Threshold;
13  
14 our $VERSION = '0.042'; # VERSION
15  
16 # ABSTRACT: This attribute is one of the possible options for the trace indicator.
17  
18 sub TO_JSON {
19 my $self = shift;
20 my $extra_args = $self->extra_args // {};
21 my $meta = $self->meta;
22 my %hash = %$self;
23 for my $name ( sort keys %hash ) {
24 my $attr = $meta->get_attribute($name);
25 if ( defined $attr ) {
26 my $value = $hash{$name};
27 my $type = $attr->type_constraint;
28 if ( $type && $type->equals('Bool') ) {
29 $hash{$name} = $value ? \1 : \0;
30 }
31 }
32 }
33 %hash = ( %hash, %$extra_args );
34 delete $hash{'extra_args'};
35 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
36 $hash{type} = $self->type();
37 }
38 return \%hash;
39 }
40  
41 has axis => ( is => "rw",
42 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Indicator::Gauge::Axis", );
43  
44 has bar => ( is => "rw",
45 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Indicator::Gauge::Bar", );
46  
47 has bgcolor => ( is => "rw",
48 isa => "Str",
49 documentation => "Sets the gauge background color.",
50 );
51  
52 has bordercolor => ( is => "rw",
53 isa => "Str",
54 documentation => "Sets the color of the border enclosing the gauge.",
55 );
56  
57 has borderwidth => ( is => "rw",
58 isa => "Num",
59 documentation => "Sets the width (in px) of the border enclosing the gauge.",
60 );
61  
62 has description => ( is => "ro",
63 default => "The gauge of the Indicator plot.", );
64  
65 has shape => ( is => "rw",
66 isa => enum( [ "angular", "bullet" ] ),
67 documentation => "Set the shape of the gauge",
68 );
69  
70 has steps => ( is => "rw",
71 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Indicator::Gauge::Step]", );
72  
73 has threshold => ( is => "rw",
74 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Indicator::Gauge::Threshold", );
75  
76 __PACKAGE__->meta->make_immutable();
77 1;
78  
79 __END__