File Coverage

blib/lib/Chart/Plotly/Trace/Scatter/Marker.pm
Criterion Covered Total %
statement 18 34 52.9
branch 0 8 0.0
condition 0 8 0.0
subroutine 6 7 85.7
pod 1 1 100.0
total 25 58 43.1


line stmt bran cond sub pod time code
1             use Moose;
2 5     5   77682 use MooseX::ExtraArgs;
  5         351784  
  5         36  
3 5     5   27709 use Moose::Util::TypeConstraints qw(enum union);
  5         675  
  5         29  
4 5     5   24392 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
  5         10  
  5         37  
5             Moose::Util::TypeConstraints::type('PDL');
6             }
7              
8             use Chart::Plotly::Trace::Scatter::Marker::Colorbar;
9 5     5   4762 use Chart::Plotly::Trace::Scatter::Marker::Gradient;
  5         17  
  5         199  
10 5     5   2597 use Chart::Plotly::Trace::Scatter::Marker::Line;
  5         18  
  5         183  
11 5     5   2525  
  5         20  
  5         2500  
12             our $VERSION = '0.042'; # VERSION
13              
14             # ABSTRACT: This attribute is one of the possible options for the trace scatter.
15              
16             my $self = shift;
17             my $extra_args = $self->extra_args // {};
18 0     0 1   my $meta = $self->meta;
19 0   0       my %hash = %$self;
20 0           for my $name ( sort keys %hash ) {
21 0           my $attr = $meta->get_attribute($name);
22 0           if ( defined $attr ) {
23 0           my $value = $hash{$name};
24 0 0         my $type = $attr->type_constraint;
25 0           if ( $type && $type->equals('Bool') ) {
26 0           $hash{$name} = $value ? \1 : \0;
27 0 0 0       }
28 0 0         }
29             }
30             %hash = ( %hash, %$extra_args );
31             delete $hash{'extra_args'};
32 0           if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
33 0           $hash{type} = $self->type();
34 0 0 0       }
35 0           return \%hash;
36             }
37 0            
38             has autocolorscale => (
39             is => "rw",
40             isa => "Bool",
41             documentation =>
42             "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.colorscale`. Has an effect only if in `marker.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.",
43             );
44              
45             has cauto => (
46             is => "rw",
47             isa => "Bool",
48             documentation =>
49             "Determines whether or not the color domain is computed with respect to the input data (here in `marker.color`) or the bounds set in `marker.cmin` and `marker.cmax` Has an effect only if in `marker.color` is set to a numerical array. Defaults to `false` when `marker.cmin` and `marker.cmax` are set by the user.",
50             );
51              
52             has cmax => (
53             is => "rw",
54             isa => "Num",
55             documentation =>
56             "Sets the upper bound of the color domain. Has an effect only if in `marker.color` is set to a numerical array. Value should have the same units as in `marker.color` and if set, `marker.cmin` must be set as well.",
57             );
58              
59             has cmid => (
60             is => "rw",
61             isa => "Num",
62             documentation =>
63             "Sets the mid-point of the color domain by scaling `marker.cmin` and/or `marker.cmax` to be equidistant to this point. Has an effect only if in `marker.color` is set to a numerical array. Value should have the same units as in `marker.color`. Has no effect when `marker.cauto` is `false`.",
64             );
65              
66             has cmin => (
67             is => "rw",
68             isa => "Num",
69             documentation =>
70             "Sets the lower bound of the color domain. Has an effect only if in `marker.color` is set to a numerical array. Value should have the same units as in `marker.color` and if set, `marker.cmax` must be set as well.",
71             );
72              
73             has color => (
74             is => "rw",
75             isa => "Str|ArrayRef[Str]",
76             documentation =>
77             "Sets the marker 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.cmin` and `marker.cmax` if set.",
78             );
79              
80             has coloraxis => (
81             is => "rw",
82             documentation =>
83             "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.",
84             );
85              
86             has colorbar => ( is => "rw",
87             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Marker::Colorbar", );
88              
89             has colorscale => (
90             is => "rw",
91             documentation =>
92             "Sets the colorscale. Has an effect only if in `marker.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.cmin` and `marker.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.",
93             );
94              
95             has colorsrc => ( is => "rw",
96             isa => "Str",
97             documentation => "Sets the source reference on Chart Studio Cloud for `color`.",
98             );
99              
100             has gradient => ( is => "rw",
101             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Marker::Gradient", );
102              
103             has line => ( is => "rw",
104             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Marker::Line", );
105              
106             has maxdisplayed => (
107             is => "rw",
108             isa => "Num",
109             documentation => "Sets a maximum number of points to be drawn on the graph. *0* corresponds to no limit.",
110             );
111              
112             has opacity => ( is => "rw",
113             isa => "Num|ArrayRef[Num]",
114             documentation => "Sets the marker opacity.",
115             );
116              
117             has opacitysrc => ( is => "rw",
118             isa => "Str",
119             documentation => "Sets the source reference on Chart Studio Cloud for `opacity`.",
120             );
121              
122             has reversescale => (
123             is => "rw",
124             isa => "Bool",
125             documentation =>
126             "Reverses the color mapping if true. Has an effect only if in `marker.color` is set to a numerical array. If true, `marker.cmin` will correspond to the last color in the array and `marker.cmax` will correspond to the first color.",
127             );
128              
129             has showscale => (
130             is => "rw",
131             isa => "Bool",
132             documentation =>
133             "Determines whether or not a colorbar is displayed for this trace. Has an effect only if in `marker.color` is set to a numerical array.",
134             );
135              
136             has size => ( is => "rw",
137             isa => "Num|ArrayRef[Num]",
138             documentation => "Sets the marker size (in px).",
139             );
140              
141             has sizemin => (
142             is => "rw",
143             isa => "Num",
144             documentation =>
145             "Has an effect only if `marker.size` is set to a numerical array. Sets the minimum size (in px) of the rendered marker points.",
146             );
147              
148             has sizemode => (
149             is => "rw",
150             isa => enum( [ "diameter", "area" ] ),
151             documentation =>
152             "Has an effect only if `marker.size` is set to a numerical array. Sets the rule for which the data in `size` is converted to pixels.",
153             );
154              
155             has sizeref => (
156             is => "rw",
157             isa => "Num",
158             documentation =>
159             "Has an effect only if `marker.size` is set to a numerical array. Sets the scale factor used to determine the rendered size of marker points. Use with `sizemin` and `sizemode`.",
160             );
161              
162             has sizesrc => ( is => "rw",
163             isa => "Str",
164             documentation => "Sets the source reference on Chart Studio Cloud for `size`.",
165             );
166              
167             has symbol => (
168             is => "rw",
169             isa => "Maybe[ArrayRef]",
170             documentation =>
171             "Sets the marker symbol type. Adding 100 is equivalent to appending *-open* to a symbol name. Adding 200 is equivalent to appending *-dot* to a symbol name. Adding 300 is equivalent to appending *-open-dot* or *dot-open* to a symbol name.",
172             );
173              
174             has symbolsrc => ( is => "rw",
175             isa => "Str",
176             documentation => "Sets the source reference on Chart Studio Cloud for `symbol`.",
177             );
178              
179             __PACKAGE__->meta->make_immutable();
180             1;
181              
182              
183             =pod
184              
185             =encoding utf-8
186              
187             =head1 NAME
188              
189             Chart::Plotly::Trace::Scatter::Marker - This attribute is one of the possible options for the trace scatter.
190              
191             =head1 VERSION
192              
193             version 0.042
194              
195             =head1 SYNOPSIS
196              
197             use HTML::Show;
198             use Chart::Plotly;
199             use Chart::Plotly::Trace::Scatter;
200             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
201            
202             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
203              
204             =head1 DESCRIPTION
205              
206             This attribute is part of the possible options for the trace scatter.
207              
208             This file has been autogenerated from the official plotly.js source.
209              
210             If you like Plotly, please support them: L<https://plot.ly/>
211             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
212              
213             Full reference: L<https://plot.ly/javascript/reference/#scatter>
214              
215             =head1 DISCLAIMER
216              
217             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
218             But I think plotly.js is a great library and I want to use it with perl.
219              
220             =head1 METHODS
221              
222             =head2 TO_JSON
223              
224             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
225              
226             =head1 ATTRIBUTES
227              
228             =over
229              
230             =item * autocolorscale
231              
232             Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `marker.colorscale`. Has an effect only if in `marker.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.
233              
234             =item * cauto
235              
236             Determines whether or not the color domain is computed with respect to the input data (here in `marker.color`) or the bounds set in `marker.cmin` and `marker.cmax` Has an effect only if in `marker.color` is set to a numerical array. Defaults to `false` when `marker.cmin` and `marker.cmax` are set by the user.
237              
238             =item * cmax
239              
240             Sets the upper bound of the color domain. Has an effect only if in `marker.color` is set to a numerical array. Value should have the same units as in `marker.color` and if set, `marker.cmin` must be set as well.
241              
242             =item * cmid
243              
244             Sets the mid-point of the color domain by scaling `marker.cmin` and/or `marker.cmax` to be equidistant to this point. Has an effect only if in `marker.color` is set to a numerical array. Value should have the same units as in `marker.color`. Has no effect when `marker.cauto` is `false`.
245              
246             =item * cmin
247              
248             Sets the lower bound of the color domain. Has an effect only if in `marker.color` is set to a numerical array. Value should have the same units as in `marker.color` and if set, `marker.cmax` must be set as well.
249              
250             =item * color
251              
252             Sets the marker 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.cmin` and `marker.cmax` if set.
253              
254             =item * coloraxis
255              
256             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.
257              
258             =item * colorbar
259              
260             =item * colorscale
261              
262             Sets the colorscale. Has an effect only if in `marker.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.cmin` and `marker.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.
263              
264             =item * colorsrc
265              
266             Sets the source reference on Chart Studio Cloud for `color`.
267              
268             =item * gradient
269              
270             =item * line
271              
272             =item * maxdisplayed
273              
274             Sets a maximum number of points to be drawn on the graph. *0* corresponds to no limit.
275              
276             =item * opacity
277              
278             Sets the marker opacity.
279              
280             =item * opacitysrc
281              
282             Sets the source reference on Chart Studio Cloud for `opacity`.
283              
284             =item * reversescale
285              
286             Reverses the color mapping if true. Has an effect only if in `marker.color` is set to a numerical array. If true, `marker.cmin` will correspond to the last color in the array and `marker.cmax` will correspond to the first color.
287              
288             =item * showscale
289              
290             Determines whether or not a colorbar is displayed for this trace. Has an effect only if in `marker.color` is set to a numerical array.
291              
292             =item * size
293              
294             Sets the marker size (in px).
295              
296             =item * sizemin
297              
298             Has an effect only if `marker.size` is set to a numerical array. Sets the minimum size (in px) of the rendered marker points.
299              
300             =item * sizemode
301              
302             Has an effect only if `marker.size` is set to a numerical array. Sets the rule for which the data in `size` is converted to pixels.
303              
304             =item * sizeref
305              
306             Has an effect only if `marker.size` is set to a numerical array. Sets the scale factor used to determine the rendered size of marker points. Use with `sizemin` and `sizemode`.
307              
308             =item * sizesrc
309              
310             Sets the source reference on Chart Studio Cloud for `size`.
311              
312             =item * symbol
313              
314             Sets the marker symbol type. Adding 100 is equivalent to appending *-open* to a symbol name. Adding 200 is equivalent to appending *-dot* to a symbol name. Adding 300 is equivalent to appending *-open-dot* or *dot-open* to a symbol name.
315              
316             =item * symbolsrc
317              
318             Sets the source reference on Chart Studio Cloud for `symbol`.
319              
320             =back
321              
322             =head1 AUTHOR
323              
324             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
325              
326             =head1 COPYRIGHT AND LICENSE
327              
328             This software is Copyright (c) 2022 by Pablo Rodríguez González.
329              
330             This is free software, licensed under:
331              
332             The MIT (X11) License
333              
334             =cut