File Coverage

blib/lib/Chart/Plotly/Trace/Scatter/Selected/Marker.pm
Criterion Covered Total %
statement 9 25 36.0
branch 0 8 0.0
condition 0 8 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 13 46 28.2


line stmt bran cond sub pod time code
1             package Chart::Plotly::Trace::Scatter::Selected::Marker;
2 4     4   31 use Moose;
  4         13  
  4         30  
3 4     4   25073 use MooseX::ExtraArgs;
  4         10  
  4         26  
4 4     4   8051 use Moose::Util::TypeConstraints qw(enum union);
  4         11  
  4         31  
5             if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
6             Moose::Util::TypeConstraints::type('PDL');
7             }
8              
9             our $VERSION = '0.041'; # VERSION
10              
11             # ABSTRACT: This attribute is one of the possible options for the trace scatter.
12              
13             sub TO_JSON {
14 0     0 1   my $self = shift;
15 0   0       my $extra_args = $self->extra_args // {};
16 0           my $meta = $self->meta;
17 0           my %hash = %$self;
18 0           for my $name ( sort keys %hash ) {
19 0           my $attr = $meta->get_attribute($name);
20 0 0         if ( defined $attr ) {
21 0           my $value = $hash{$name};
22 0           my $type = $attr->type_constraint;
23 0 0 0       if ( $type && $type->equals('Bool') ) {
24 0 0         $hash{$name} = $value ? \1 : \0;
25             }
26             }
27             }
28 0           %hash = ( %hash, %$extra_args );
29 0           delete $hash{'extra_args'};
30 0 0 0       if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
31 0           $hash{type} = $self->type();
32             }
33 0           return \%hash;
34             }
35              
36             has color => ( is => "rw",
37             isa => "Str",
38             documentation => "Sets the marker color of selected points.",
39             );
40              
41             has opacity => ( is => "rw",
42             isa => "Num",
43             documentation => "Sets the marker opacity of selected points.",
44             );
45              
46             has size => ( is => "rw",
47             isa => "Num",
48             documentation => "Sets the marker size of selected points.",
49             );
50              
51             __PACKAGE__->meta->make_immutable();
52             1;
53              
54             __END__
55              
56             =pod
57              
58             =encoding utf-8
59              
60             =head1 NAME
61              
62             Chart::Plotly::Trace::Scatter::Selected::Marker - This attribute is one of the possible options for the trace scatter.
63              
64             =head1 VERSION
65              
66             version 0.041
67              
68             =head1 SYNOPSIS
69              
70             use HTML::Show;
71             use Chart::Plotly;
72             use Chart::Plotly::Trace::Scatter;
73             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
74            
75             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
76              
77             =head1 DESCRIPTION
78              
79             This attribute is part of the possible options for the trace scatter.
80              
81             This file has been autogenerated from the official plotly.js source.
82              
83             If you like Plotly, please support them: L<https://plot.ly/>
84             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
85              
86             Full reference: L<https://plot.ly/javascript/reference/#scatter>
87              
88             =head1 DISCLAIMER
89              
90             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
91             But I think plotly.js is a great library and I want to use it with perl.
92              
93             =head1 METHODS
94              
95             =head2 TO_JSON
96              
97             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
98              
99             =head1 ATTRIBUTES
100              
101             =over
102              
103             =item * color
104              
105             Sets the marker color of selected points.
106              
107             =item * opacity
108              
109             Sets the marker opacity of selected points.
110              
111             =item * size
112              
113             Sets the marker size of selected points.
114              
115             =back
116              
117             =head1 AUTHOR
118              
119             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
120              
121             =head1 COPYRIGHT AND LICENSE
122              
123             This software is Copyright (c) 2020 by Pablo Rodríguez González.
124              
125             This is free software, licensed under:
126              
127             The MIT (X11) License
128              
129             =cut