File Coverage

blib/lib/Chart/Plotly/Trace/Scatter/Marker/Line.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             use Moose;
2 5     5   32 use MooseX::ExtraArgs;
  5         9  
  5         36  
3 5     5   27741 use Moose::Util::TypeConstraints qw(enum union);
  5         10  
  5         35  
4 5     5   8941 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
  5         10  
  5         44  
5             Moose::Util::TypeConstraints::type('PDL');
6             }
7              
8             our $VERSION = '0.042'; # VERSION
9              
10             # ABSTRACT: This attribute is one of the possible options for the trace scatter.
11              
12             my $self = shift;
13             my $extra_args = $self->extra_args // {};
14 0     0 1   my $meta = $self->meta;
15 0   0       my %hash = %$self;
16 0           for my $name ( sort keys %hash ) {
17 0           my $attr = $meta->get_attribute($name);
18 0           if ( defined $attr ) {
19 0           my $value = $hash{$name};
20 0 0         my $type = $attr->type_constraint;
21 0           if ( $type && $type->equals('Bool') ) {
22 0           $hash{$name} = $value ? \1 : \0;
23 0 0 0       }
24 0 0         }
25             }
26             %hash = ( %hash, %$extra_args );
27             delete $hash{'extra_args'};
28 0           if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
29 0           $hash{type} = $self->type();
30 0 0 0       }
31 0           return \%hash;
32             }
33 0            
34             has autocolorscale => (
35             is => "rw",
36             isa => "Bool",
37             documentation =>
38             "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.line.colorscale`. Has an effect only if in `marker.line.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.",
39             );
40              
41             has cauto => (
42             is => "rw",
43             isa => "Bool",
44             documentation =>
45             "Determines whether or not the color domain is computed with respect to the input data (here in `marker.line.color`) or the bounds set in `marker.line.cmin` and `marker.line.cmax` Has an effect only if in `marker.line.color` is set to a numerical array. Defaults to `false` when `marker.line.cmin` and `marker.line.cmax` are set by the user.",
46             );
47              
48             has cmax => (
49             is => "rw",
50             isa => "Num",
51             documentation =>
52             "Sets the upper bound of the color domain. Has an effect only if in `marker.line.color` is set to a numerical array. Value should have the same units as in `marker.line.color` and if set, `marker.line.cmin` must be set as well.",
53             );
54              
55             has cmid => (
56             is => "rw",
57             isa => "Num",
58             documentation =>
59             "Sets the mid-point of the color domain by scaling `marker.line.cmin` and/or `marker.line.cmax` to be equidistant to this point. Has an effect only if in `marker.line.color` is set to a numerical array. Value should have the same units as in `marker.line.color`. Has no effect when `marker.line.cauto` is `false`.",
60             );
61              
62             has cmin => (
63             is => "rw",
64             isa => "Num",
65             documentation =>
66             "Sets the lower bound of the color domain. Has an effect only if in `marker.line.color` is set to a numerical array. Value should have the same units as in `marker.line.color` and if set, `marker.line.cmax` must be set as well.",
67             );
68              
69             has color => (
70             is => "rw",
71             isa => "Str|ArrayRef[Str]",
72             documentation =>
73             "Sets the marker.line color. It accepts either a specific color or an array of numbers that are mapped to the colorscale relative to the max and min values of the array or relative to `marker.line.cmin` and `marker.line.cmax` if set.",
74             );
75              
76             has coloraxis => (
77             is => "rw",
78             documentation =>
79             "Sets a reference to a shared color axis. References to these shared color axes are *coloraxis*, *coloraxis2*, *coloraxis3*, etc. Settings for these shared color axes are set in the layout, under `layout.coloraxis`, `layout.coloraxis2`, etc. Note that multiple color scales can be linked to the same color axis.",
80             );
81              
82             has colorscale => (
83             is => "rw",
84             documentation =>
85             "Sets the colorscale. Has an effect only if in `marker.line.color` is set to a numerical array. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use `marker.line.cmin` and `marker.line.cmax`. Alternatively, `colorscale` may be a palette name string of the following list: Blackbody,Bluered,Blues,Cividis,Earth,Electric,Greens,Greys,Hot,Jet,Picnic,Portland,Rainbow,RdBu,Reds,Viridis,YlGnBu,YlOrRd.",
86             );
87              
88             has colorsrc => ( is => "rw",
89             isa => "Str",
90             documentation => "Sets the source reference on Chart Studio Cloud for `color`.",
91             );
92              
93             has reversescale => (
94             is => "rw",
95             isa => "Bool",
96             documentation =>
97             "Reverses the color mapping if true. Has an effect only if in `marker.line.color` is set to a numerical array. If true, `marker.line.cmin` will correspond to the last color in the array and `marker.line.cmax` will correspond to the first color.",
98             );
99              
100             has width => ( is => "rw",
101             isa => "Num|ArrayRef[Num]",
102             documentation => "Sets the width (in px) of the lines bounding the marker points.",
103             );
104              
105             has widthsrc => ( is => "rw",
106             isa => "Str",
107             documentation => "Sets the source reference on Chart Studio Cloud for `width`.",
108             );
109              
110             __PACKAGE__->meta->make_immutable();
111             1;
112              
113              
114             =pod
115              
116             =encoding utf-8
117              
118             =head1 NAME
119              
120             Chart::Plotly::Trace::Scatter::Marker::Line - This attribute is one of the possible options for the trace scatter.
121              
122             =head1 VERSION
123              
124             version 0.042
125              
126             =head1 SYNOPSIS
127              
128             use HTML::Show;
129             use Chart::Plotly;
130             use Chart::Plotly::Trace::Scatter;
131             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
132            
133             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
134              
135             =head1 DESCRIPTION
136              
137             This attribute is part of the possible options for the trace scatter.
138              
139             This file has been autogenerated from the official plotly.js source.
140              
141             If you like Plotly, please support them: L<https://plot.ly/>
142             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
143              
144             Full reference: L<https://plot.ly/javascript/reference/#scatter>
145              
146             =head1 DISCLAIMER
147              
148             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
149             But I think plotly.js is a great library and I want to use it with perl.
150              
151             =head1 METHODS
152              
153             =head2 TO_JSON
154              
155             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
156              
157             =head1 ATTRIBUTES
158              
159             =over
160              
161             =item * autocolorscale
162              
163             Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.line.colorscale`. Has an effect only if in `marker.line.color` is set to a numerical array. In case `colorscale` is unspecified or `autocolorscale` is true, the default palette will be chosen according to whether numbers in the `color` array are all positive, all negative or mixed.
164              
165             =item * cauto
166              
167             Determines whether or not the color domain is computed with respect to the input data (here in `marker.line.color`) or the bounds set in `marker.line.cmin` and `marker.line.cmax` Has an effect only if in `marker.line.color` is set to a numerical array. Defaults to `false` when `marker.line.cmin` and `marker.line.cmax` are set by the user.
168              
169             =item * cmax
170              
171             Sets the upper bound of the color domain. Has an effect only if in `marker.line.color` is set to a numerical array. Value should have the same units as in `marker.line.color` and if set, `marker.line.cmin` must be set as well.
172              
173             =item * cmid
174              
175             Sets the mid-point of the color domain by scaling `marker.line.cmin` and/or `marker.line.cmax` to be equidistant to this point. Has an effect only if in `marker.line.color` is set to a numerical array. Value should have the same units as in `marker.line.color`. Has no effect when `marker.line.cauto` is `false`.
176              
177             =item * cmin
178              
179             Sets the lower bound of the color domain. Has an effect only if in `marker.line.color` is set to a numerical array. Value should have the same units as in `marker.line.color` and if set, `marker.line.cmax` must be set as well.
180              
181             =item * color
182              
183             Sets the marker.line color. It accepts either a specific color or an array of numbers that are mapped to the colorscale relative to the max and min values of the array or relative to `marker.line.cmin` and `marker.line.cmax` if set.
184              
185             =item * coloraxis
186              
187             Sets a reference to a shared color axis. References to these shared color axes are *coloraxis*, *coloraxis2*, *coloraxis3*, etc. Settings for these shared color axes are set in the layout, under `layout.coloraxis`, `layout.coloraxis2`, etc. Note that multiple color scales can be linked to the same color axis.
188              
189             =item * colorscale
190              
191             Sets the colorscale. Has an effect only if in `marker.line.color` is set to a numerical array. The colorscale must be an array containing arrays mapping a normalized value to an rgb, rgba, hex, hsl, hsv, or named color string. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 'rgb(0,0,255)'], [1, 'rgb(255,0,0)']]`. To control the bounds of the colorscale in color space, use `marker.line.cmin` and `marker.line.cmax`. Alternatively, `colorscale` may be a palette name string of the following list: Blackbody,Bluered,Blues,Cividis,Earth,Electric,Greens,Greys,Hot,Jet,Picnic,Portland,Rainbow,RdBu,Reds,Viridis,YlGnBu,YlOrRd.
192              
193             =item * colorsrc
194              
195             Sets the source reference on Chart Studio Cloud for `color`.
196              
197             =item * reversescale
198              
199             Reverses the color mapping if true. Has an effect only if in `marker.line.color` is set to a numerical array. If true, `marker.line.cmin` will correspond to the last color in the array and `marker.line.cmax` will correspond to the first color.
200              
201             =item * width
202              
203             Sets the width (in px) of the lines bounding the marker points.
204              
205             =item * widthsrc
206              
207             Sets the source reference on Chart Studio Cloud for `width`.
208              
209             =back
210              
211             =head1 AUTHOR
212              
213             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
214              
215             =head1 COPYRIGHT AND LICENSE
216              
217             This software is Copyright (c) 2022 by Pablo Rodríguez González.
218              
219             This is free software, licensed under:
220              
221             The MIT (X11) License
222              
223             =cut