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