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             package Chart::Plotly::Trace::Scatter::Marker::Line;
2 5     5   39 use Moose;
  5         13  
  5         43  
3 5     5   33806 use MooseX::ExtraArgs;
  5         14  
  5         46  
4 5     5   10587 use Moose::Util::TypeConstraints qw(enum union);
  5         12  
  5         50  
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 autocolorscale => (
37             is => "rw",
38             isa => "Bool",
39             documentation =>
40             "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.",
41             );
42              
43             has cauto => (
44             is => "rw",
45             isa => "Bool",
46             documentation =>
47             "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.",
48             );
49              
50             has cmax => (
51             is => "rw",
52             isa => "Num",
53             documentation =>
54             "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.",
55             );
56              
57             has cmid => (
58             is => "rw",
59             isa => "Num",
60             documentation =>
61             "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`.",
62             );
63              
64             has cmin => (
65             is => "rw",
66             isa => "Num",
67             documentation =>
68             "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.",
69             );
70              
71             has color => (
72             is => "rw",
73             isa => "Str|ArrayRef[Str]",
74             documentation =>
75             "Sets themarker.linecolor. 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.",
76             );
77              
78             has coloraxis => (
79             is => "rw",
80             documentation =>
81             "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.",
82             );
83              
84             has colorscale => (
85             is => "rw",
86             documentation =>
87             "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: Greys,YlGnBu,Greens,YlOrRd,Bluered,RdBu,Reds,Blues,Picnic,Rainbow,Portland,Jet,Hot,Blackbody,Earth,Electric,Viridis,Cividis.",
88             );
89              
90             has colorsrc => ( is => "rw",
91             isa => "Str",
92             documentation => "Sets the source reference on plot.ly for color .",
93             );
94              
95             has reversescale => (
96             is => "rw",
97             isa => "Bool",
98             documentation =>
99             "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.",
100             );
101              
102             has width => ( is => "rw",
103             isa => "Num|ArrayRef[Num]",
104             documentation => "Sets the width (in px) of the lines bounding the marker points.",
105             );
106              
107             has widthsrc => ( is => "rw",
108             isa => "Str",
109             documentation => "Sets the source reference on plot.ly for width .",
110             );
111              
112             __PACKAGE__->meta->make_immutable();
113             1;
114              
115             __END__
116              
117             =pod
118              
119             =encoding utf-8
120              
121             =head1 NAME
122              
123             Chart::Plotly::Trace::Scatter::Marker::Line - This attribute is one of the possible options for the trace scatter.
124              
125             =head1 VERSION
126              
127             version 0.041
128              
129             =head1 SYNOPSIS
130              
131             use HTML::Show;
132             use Chart::Plotly;
133             use Chart::Plotly::Trace::Scatter;
134             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
135            
136             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
137              
138             =head1 DESCRIPTION
139              
140             This attribute is part of the possible options for the trace scatter.
141              
142             This file has been autogenerated from the official plotly.js source.
143              
144             If you like Plotly, please support them: L<https://plot.ly/>
145             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
146              
147             Full reference: L<https://plot.ly/javascript/reference/#scatter>
148              
149             =head1 DISCLAIMER
150              
151             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
152             But I think plotly.js is a great library and I want to use it with perl.
153              
154             =head1 METHODS
155              
156             =head2 TO_JSON
157              
158             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
159              
160             =head1 ATTRIBUTES
161              
162             =over
163              
164             =item * autocolorscale
165              
166             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.
167              
168             =item * cauto
169              
170             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.
171              
172             =item * cmax
173              
174             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.
175              
176             =item * cmid
177              
178             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`.
179              
180             =item * cmin
181              
182             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.
183              
184             =item * color
185              
186             Sets themarker.linecolor. 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.
187              
188             =item * coloraxis
189              
190             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.
191              
192             =item * colorscale
193              
194             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: Greys,YlGnBu,Greens,YlOrRd,Bluered,RdBu,Reds,Blues,Picnic,Rainbow,Portland,Jet,Hot,Blackbody,Earth,Electric,Viridis,Cividis.
195              
196             =item * colorsrc
197              
198             Sets the source reference on plot.ly for color .
199              
200             =item * reversescale
201              
202             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.
203              
204             =item * width
205              
206             Sets the width (in px) of the lines bounding the marker points.
207              
208             =item * widthsrc
209              
210             Sets the source reference on plot.ly for width .
211              
212             =back
213              
214             =head1 AUTHOR
215              
216             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
217              
218             =head1 COPYRIGHT AND LICENSE
219              
220             This software is Copyright (c) 2020 by Pablo Rodríguez González.
221              
222             This is free software, licensed under:
223              
224             The MIT (X11) License
225              
226             =cut