File Coverage

blib/lib/Chart/Plotly/Trace/Scatter/Hoverlabel.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             use Moose;
2 4     4   24 use MooseX::ExtraArgs;
  4         8  
  4         42  
3 4     4   22020 use Moose::Util::TypeConstraints qw(enum union);
  4         9  
  4         35  
4 4     4   6860 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
  4         8  
  4         30  
5             Moose::Util::TypeConstraints::type('PDL');
6             }
7              
8             use Chart::Plotly::Trace::Scatter::Hoverlabel::Font;
9 4     4   3555  
  4         13  
  4         1272  
10             our $VERSION = '0.042'; # VERSION
11              
12             # ABSTRACT: This attribute is one of the possible options for the trace scatter.
13              
14             my $self = shift;
15             my $extra_args = $self->extra_args // {};
16 0     0 1   my $meta = $self->meta;
17 0   0       my %hash = %$self;
18 0           for my $name ( sort keys %hash ) {
19 0           my $attr = $meta->get_attribute($name);
20 0           if ( defined $attr ) {
21 0           my $value = $hash{$name};
22 0 0         my $type = $attr->type_constraint;
23 0           if ( $type && $type->equals('Bool') ) {
24 0           $hash{$name} = $value ? \1 : \0;
25 0 0 0       }
26 0 0         }
27             }
28             %hash = ( %hash, %$extra_args );
29             delete $hash{'extra_args'};
30 0           if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
31 0           $hash{type} = $self->type();
32 0 0 0       }
33 0           return \%hash;
34             }
35 0            
36             has align => (
37             is => "rw",
38             isa => union( [ enum( [ "left", "right", "auto" ] ), "ArrayRef" ] ),
39             documentation =>
40             "Sets the horizontal alignment of the text content within hover label box. Has an effect only if the hover label text spans more two or more lines",
41             );
42              
43             has alignsrc => ( is => "rw",
44             isa => "Str",
45             documentation => "Sets the source reference on Chart Studio Cloud for `align`.",
46             );
47              
48             has bgcolor => ( is => "rw",
49             isa => "Str|ArrayRef[Str]",
50             documentation => "Sets the background color of the hover labels for this trace",
51             );
52              
53             has bgcolorsrc => ( is => "rw",
54             isa => "Str",
55             documentation => "Sets the source reference on Chart Studio Cloud for `bgcolor`.",
56             );
57              
58             has bordercolor => ( is => "rw",
59             isa => "Str|ArrayRef[Str]",
60             documentation => "Sets the border color of the hover labels for this trace.",
61             );
62              
63             has bordercolorsrc => ( is => "rw",
64             isa => "Str",
65             documentation => "Sets the source reference on Chart Studio Cloud for `bordercolor`.",
66             );
67              
68             has font => ( is => "rw",
69             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Hoverlabel::Font", );
70              
71             has namelength => (
72             is => "rw",
73             isa => "Int|ArrayRef[Int]",
74             documentation =>
75             "Sets the default length (in number of characters) of the trace name in the hover labels for all traces. -1 shows the whole name regardless of length. 0-3 shows the first 0-3 characters, and an integer >3 will show the whole name if it is less than that many characters, but if it is longer, will truncate to `namelength - 3` characters and add an ellipsis.",
76             );
77              
78             has namelengthsrc => ( is => "rw",
79             isa => "Str",
80             documentation => "Sets the source reference on Chart Studio Cloud for `namelength`.",
81             );
82              
83             __PACKAGE__->meta->make_immutable();
84             1;
85              
86              
87             =pod
88              
89             =encoding utf-8
90              
91             =head1 NAME
92              
93             Chart::Plotly::Trace::Scatter::Hoverlabel - This attribute is one of the possible options for the trace scatter.
94              
95             =head1 VERSION
96              
97             version 0.042
98              
99             =head1 SYNOPSIS
100              
101             use HTML::Show;
102             use Chart::Plotly;
103             use Chart::Plotly::Trace::Scatter;
104             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
105            
106             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
107              
108             =head1 DESCRIPTION
109              
110             This attribute is part of the possible options for the trace scatter.
111              
112             This file has been autogenerated from the official plotly.js source.
113              
114             If you like Plotly, please support them: L<https://plot.ly/>
115             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
116              
117             Full reference: L<https://plot.ly/javascript/reference/#scatter>
118              
119             =head1 DISCLAIMER
120              
121             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
122             But I think plotly.js is a great library and I want to use it with perl.
123              
124             =head1 METHODS
125              
126             =head2 TO_JSON
127              
128             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
129              
130             =head1 ATTRIBUTES
131              
132             =over
133              
134             =item * align
135              
136             Sets the horizontal alignment of the text content within hover label box. Has an effect only if the hover label text spans more two or more lines
137              
138             =item * alignsrc
139              
140             Sets the source reference on Chart Studio Cloud for `align`.
141              
142             =item * bgcolor
143              
144             Sets the background color of the hover labels for this trace
145              
146             =item * bgcolorsrc
147              
148             Sets the source reference on Chart Studio Cloud for `bgcolor`.
149              
150             =item * bordercolor
151              
152             Sets the border color of the hover labels for this trace.
153              
154             =item * bordercolorsrc
155              
156             Sets the source reference on Chart Studio Cloud for `bordercolor`.
157              
158             =item * font
159              
160             =item * namelength
161              
162             Sets the default length (in number of characters) of the trace name in the hover labels for all traces. -1 shows the whole name regardless of length. 0-3 shows the first 0-3 characters, and an integer >3 will show the whole name if it is less than that many characters, but if it is longer, will truncate to `namelength - 3` characters and add an ellipsis.
163              
164             =item * namelengthsrc
165              
166             Sets the source reference on Chart Studio Cloud for `namelength`.
167              
168             =back
169              
170             =head1 AUTHOR
171              
172             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
173              
174             =head1 COPYRIGHT AND LICENSE
175              
176             This software is Copyright (c) 2022 by Pablo Rodríguez González.
177              
178             This is free software, licensed under:
179              
180             The MIT (X11) License
181              
182             =cut