File Coverage

blib/lib/Chart/Plotly/Trace/Scatter/Marker/Colorbar/Title.pm
Criterion Covered Total %
statement 12 28 42.8
branch 0 8 0.0
condition 0 8 0.0
subroutine 4 5 80.0
pod 1 1 100.0
total 17 50 34.0


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