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             package Chart::Plotly::Trace::Scatter::Hoverlabel;
2 4     4   32 use Moose;
  4         10  
  4         33  
3 4     4   27695 use MooseX::ExtraArgs;
  4         11  
  4         35  
4 4     4   8510 use Moose::Util::TypeConstraints qw(enum union);
  4         10  
  4         39  
5             if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
6             Moose::Util::TypeConstraints::type('PDL');
7             }
8              
9 4     4   4373 use Chart::Plotly::Trace::Scatter::Hoverlabel::Font;
  4         15  
  4         1624  
10              
11             our $VERSION = '0.041'; # 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 align => (
39             is => "rw",
40             isa => union( [ enum( [ "left", "right", "auto" ] ), "ArrayRef" ] ),
41             documentation =>
42             "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",
43             );
44              
45             has alignsrc => ( is => "rw",
46             isa => "Str",
47             documentation => "Sets the source reference on plot.ly for align .",
48             );
49              
50             has bgcolor => ( is => "rw",
51             isa => "Str|ArrayRef[Str]",
52             documentation => "Sets the background color of the hover labels for this trace",
53             );
54              
55             has bgcolorsrc => ( is => "rw",
56             isa => "Str",
57             documentation => "Sets the source reference on plot.ly for bgcolor .",
58             );
59              
60             has bordercolor => ( is => "rw",
61             isa => "Str|ArrayRef[Str]",
62             documentation => "Sets the border color of the hover labels for this trace.",
63             );
64              
65             has bordercolorsrc => ( is => "rw",
66             isa => "Str",
67             documentation => "Sets the source reference on plot.ly for bordercolor .",
68             );
69              
70             has font => ( is => "rw",
71             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Hoverlabel::Font", );
72              
73             has namelength => (
74             is => "rw",
75             isa => "Int|ArrayRef[Int]",
76             documentation =>
77             "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.",
78             );
79              
80             has namelengthsrc => ( is => "rw",
81             isa => "Str",
82             documentation => "Sets the source reference on plot.ly for namelength .",
83             );
84              
85             __PACKAGE__->meta->make_immutable();
86             1;
87              
88             __END__
89              
90             =pod
91              
92             =encoding utf-8
93              
94             =head1 NAME
95              
96             Chart::Plotly::Trace::Scatter::Hoverlabel - This attribute is one of the possible options for the trace scatter.
97              
98             =head1 VERSION
99              
100             version 0.041
101              
102             =head1 SYNOPSIS
103              
104             use HTML::Show;
105             use Chart::Plotly;
106             use Chart::Plotly::Trace::Scatter;
107             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
108            
109             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
110              
111             =head1 DESCRIPTION
112              
113             This attribute is part of the possible options for the trace scatter.
114              
115             This file has been autogenerated from the official plotly.js source.
116              
117             If you like Plotly, please support them: L<https://plot.ly/>
118             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
119              
120             Full reference: L<https://plot.ly/javascript/reference/#scatter>
121              
122             =head1 DISCLAIMER
123              
124             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
125             But I think plotly.js is a great library and I want to use it with perl.
126              
127             =head1 METHODS
128              
129             =head2 TO_JSON
130              
131             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
132              
133             =head1 ATTRIBUTES
134              
135             =over
136              
137             =item * align
138              
139             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
140              
141             =item * alignsrc
142              
143             Sets the source reference on plot.ly for align .
144              
145             =item * bgcolor
146              
147             Sets the background color of the hover labels for this trace
148              
149             =item * bgcolorsrc
150              
151             Sets the source reference on plot.ly for bgcolor .
152              
153             =item * bordercolor
154              
155             Sets the border color of the hover labels for this trace.
156              
157             =item * bordercolorsrc
158              
159             Sets the source reference on plot.ly for bordercolor .
160              
161             =item * font
162              
163             =item * namelength
164              
165             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.
166              
167             =item * namelengthsrc
168              
169             Sets the source reference on plot.ly for namelength .
170              
171             =back
172              
173             =head1 AUTHOR
174              
175             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
176              
177             =head1 COPYRIGHT AND LICENSE
178              
179             This software is Copyright (c) 2020 by Pablo Rodríguez González.
180              
181             This is free software, licensed under:
182              
183             The MIT (X11) License
184              
185             =cut