File Coverage

blib/lib/Chart/Plotly/Trace/Scatter/Marker/Colorbar.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::Colorbar;
2 5     5   41 use Moose;
  5         10  
  5         37  
3 5     5   32842 use MooseX::ExtraArgs;
  5         14  
  5         34  
4 5     5   10791 use Moose::Util::TypeConstraints qw(enum union);
  5         12  
  5         53  
5             if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
6             Moose::Util::TypeConstraints::type('PDL');
7             }
8              
9 5     5   5908 use Chart::Plotly::Trace::Scatter::Marker::Colorbar::Tickfont;
  5         22  
  5         231  
10 5     5   3153 use Chart::Plotly::Trace::Scatter::Marker::Colorbar::Tickformatstop;
  5         18  
  5         229  
11 5     5   3224 use Chart::Plotly::Trace::Scatter::Marker::Colorbar::Title;
  5         22  
  5         4898  
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 bgcolor => ( is => "rw",
41             isa => "Str",
42             documentation => "Sets the color of padded area.",
43             );
44              
45             has bordercolor => ( is => "rw",
46             isa => "Str",
47             documentation => "Sets the axis line color.",
48             );
49              
50             has borderwidth => ( is => "rw",
51             isa => "Num",
52             documentation => "Sets the width (in px) or the border enclosing this color bar.",
53             );
54              
55             has dtick => (
56             is => "rw",
57             isa => "Any",
58             documentation =>
59             "Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to *log* and *date* axes. If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. *log* has several special values; *L<f>*, where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5). `tick0` is ignored for *D1* and *D2*. If the axis `type` is *date*, then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. *date* also has special values *n* gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*. To set ticks every 4 years, set `dtick` to *M48*",
60             );
61              
62             has exponentformat => (
63             is => "rw",
64             isa => enum( [ "none", "e", "E", "power", "SI", "B" ] ),
65             documentation =>
66             "Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B.",
67             );
68              
69             has len => (
70             is => "rw",
71             isa => "Num",
72             documentation =>
73             "Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends.",
74             );
75              
76             has lenmode => (
77             is => "rw",
78             isa => enum( [ "fraction", "pixels" ] ),
79             documentation =>
80             "Determines whether this color bar's length (i.e. the measure in the color variation direction) is set in units of plot *fraction* or in *pixels. Use `len` to set the value.",
81             );
82              
83             has nticks => (
84             is => "rw",
85             isa => "Int",
86             documentation =>
87             "Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to *auto*.",
88             );
89              
90             has outlinecolor => ( is => "rw",
91             isa => "Str",
92             documentation => "Sets the axis line color.",
93             );
94              
95             has outlinewidth => ( is => "rw",
96             isa => "Num",
97             documentation => "Sets the width (in px) of the axis line.",
98             );
99              
100             has separatethousands => ( is => "rw",
101             isa => "Bool",
102             documentation => "If \"true\", even 4-digit integers are separated",
103             );
104              
105             has showexponent => (
106             is => "rw",
107             isa => enum( [ "all", "first", "last", "none" ] ),
108             documentation =>
109             "If *all*, all exponents are shown besides their significands. If *first*, only the exponent of the first tick is shown. If *last*, only the exponent of the last tick is shown. If *none*, no exponents appear.",
110             );
111              
112             has showticklabels => ( is => "rw",
113             isa => "Bool",
114             documentation => "Determines whether or not the tick labels are drawn.",
115             );
116              
117             has showtickprefix => (
118             is => "rw",
119             isa => enum( [ "all", "first", "last", "none" ] ),
120             documentation =>
121             "If *all*, all tick labels are displayed with a prefix. If *first*, only the first tick is displayed with a prefix. If *last*, only the last tick is displayed with a suffix. If *none*, tick prefixes are hidden.",
122             );
123              
124             has showticksuffix => ( is => "rw",
125             isa => enum( [ "all", "first", "last", "none" ] ),
126             documentation => "Same as `showtickprefix` but for tick suffixes.",
127             );
128              
129             has thickness => (
130             is => "rw",
131             isa => "Num",
132             documentation =>
133             "Sets the thickness of the color bar This measure excludes the size of the padding, ticks and labels.",
134             );
135              
136             has thicknessmode => (
137             is => "rw",
138             isa => enum( [ "fraction", "pixels" ] ),
139             documentation =>
140             "Determines whether this color bar's thickness (i.e. the measure in the constant color direction) is set in units of plot *fraction* or in *pixels*. Use `thickness` to set the value.",
141             );
142              
143             has tick0 => (
144             is => "rw",
145             isa => "Any",
146             documentation =>
147             "Sets the placement of the first tick on this axis. Use with `dtick`. If the axis `type` is *log*, then you must take the log of your starting tick (e.g. to set the starting tick to 100, set the `tick0` to 2) except when `dtick`=*L<f>* (see `dtick` for more info). If the axis `type` is *date*, it should be a date string, like date data. If the axis `type` is *category*, it should be a number, using the scale where each category is assigned a serial number from zero in the order it appears.",
148             );
149              
150             has tickangle => (
151             is => "rw",
152             documentation =>
153             "Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically.",
154             );
155              
156             has tickcolor => ( is => "rw",
157             isa => "Str",
158             documentation => "Sets the tick color.",
159             );
160              
161             has tickfont => ( is => "rw",
162             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Marker::Colorbar::Tickfont", );
163              
164             has tickformat => (
165             is => "rw",
166             isa => "Str",
167             documentation =>
168             "Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format And for dates see: https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md#format We add one item to d3's date formatter: *%{n}f* for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat *%H~%M~%S.%2f* would display *09~15~23.46*",
169             );
170              
171             has tickformatstops => ( is => "rw",
172             isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Scatter::Marker::Colorbar::Tickformatstop]", );
173              
174             has ticklen => ( is => "rw",
175             isa => "Num",
176             documentation => "Sets the tick length (in px).",
177             );
178              
179             has tickmode => (
180             is => "rw",
181             isa => enum( [ "auto", "linear", "array" ] ),
182             documentation =>
183             "Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided).",
184             );
185              
186             has tickprefix => ( is => "rw",
187             isa => "Str",
188             documentation => "Sets a tick label prefix.",
189             );
190              
191             has ticks => (
192             is => "rw",
193             isa => enum( [ "outside", "inside", "" ] ),
194             documentation =>
195             "Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.",
196             );
197              
198             has ticksuffix => ( is => "rw",
199             isa => "Str",
200             documentation => "Sets a tick label suffix.",
201             );
202              
203             has ticktext => (
204             is => "rw",
205             isa => "ArrayRef|PDL",
206             documentation =>
207             "Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to *array*. Used with `tickvals`.",
208             );
209              
210             has ticktextsrc => ( is => "rw",
211             isa => "Str",
212             documentation => "Sets the source reference on plot.ly for ticktext .",
213             );
214              
215             has tickvals => (
216             is => "rw",
217             isa => "ArrayRef|PDL",
218             documentation =>
219             "Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to *array*. Used with `ticktext`.",
220             );
221              
222             has tickvalssrc => ( is => "rw",
223             isa => "Str",
224             documentation => "Sets the source reference on plot.ly for tickvals .",
225             );
226              
227             has tickwidth => ( is => "rw",
228             isa => "Num",
229             documentation => "Sets the tick width (in px).",
230             );
231              
232             has title => ( is => "rw",
233             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Marker::Colorbar::Title", );
234              
235             has x => ( is => "rw",
236             isa => "Num",
237             documentation => "Sets the x position of the color bar (in plot fraction).",
238             );
239              
240             has xanchor => (
241             is => "rw",
242             isa => enum( [ "left", "center", "right" ] ),
243             documentation =>
244             "Sets this color bar's horizontal position anchor. This anchor binds the `x` position to the *left*, *center* or *right* of the color bar.",
245             );
246              
247             has xpad => ( is => "rw",
248             isa => "Num",
249             documentation => "Sets the amount of padding (in px) along the x direction.",
250             );
251              
252             has y => ( is => "rw",
253             isa => "Num",
254             documentation => "Sets the y position of the color bar (in plot fraction).",
255             );
256              
257             has yanchor => (
258             is => "rw",
259             isa => enum( [ "top", "middle", "bottom" ] ),
260             documentation =>
261             "Sets this color bar's vertical position anchor This anchor binds the `y` position to the *top*, *middle* or *bottom* of the color bar.",
262             );
263              
264             has ypad => ( is => "rw",
265             isa => "Num",
266             documentation => "Sets the amount of padding (in px) along the y direction.",
267             );
268              
269             __PACKAGE__->meta->make_immutable();
270             1;
271              
272             __END__
273              
274             =pod
275              
276             =encoding utf-8
277              
278             =head1 NAME
279              
280             Chart::Plotly::Trace::Scatter::Marker::Colorbar - This attribute is one of the possible options for the trace scatter.
281              
282             =head1 VERSION
283              
284             version 0.041
285              
286             =head1 SYNOPSIS
287              
288             use HTML::Show;
289             use Chart::Plotly;
290             use Chart::Plotly::Trace::Scatter;
291             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
292            
293             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
294              
295             =head1 DESCRIPTION
296              
297             This attribute is part of the possible options for the trace scatter.
298              
299             This file has been autogenerated from the official plotly.js source.
300              
301             If you like Plotly, please support them: L<https://plot.ly/>
302             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
303              
304             Full reference: L<https://plot.ly/javascript/reference/#scatter>
305              
306             =head1 DISCLAIMER
307              
308             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
309             But I think plotly.js is a great library and I want to use it with perl.
310              
311             =head1 METHODS
312              
313             =head2 TO_JSON
314              
315             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
316              
317             =head1 ATTRIBUTES
318              
319             =over
320              
321             =item * bgcolor
322              
323             Sets the color of padded area.
324              
325             =item * bordercolor
326              
327             Sets the axis line color.
328              
329             =item * borderwidth
330              
331             Sets the width (in px) or the border enclosing this color bar.
332              
333             =item * dtick
334              
335             Sets the step in-between ticks on this axis. Use with `tick0`. Must be a positive number, or special strings available to *log* and *date* axes. If the axis `type` is *log*, then ticks are set every 10^(n*dtick) where n is the tick number. For example, to set a tick mark at 1, 10, 100, 1000, ... set dtick to 1. To set tick marks at 1, 100, 10000, ... set dtick to 2. To set tick marks at 1, 5, 25, 125, 625, 3125, ... set dtick to log_10(5), or 0.69897000433. *log* has several special values; *L<f>*, where `f` is a positive number, gives ticks linearly spaced in value (but not position). For example `tick0` = 0.1, `dtick` = *L0.5* will put ticks at 0.1, 0.6, 1.1, 1.6 etc. To show powers of 10 plus small digits between, use *D1* (all digits) or *D2* (only 2 and 5). `tick0` is ignored for *D1* and *D2*. If the axis `type` is *date*, then you must convert the time to milliseconds. For example, to set the interval between ticks to one day, set `dtick` to 86400000.0. *date* also has special values *n* gives ticks spaced by a number of months. `n` must be a positive integer. To set ticks on the 15th of every third month, set `tick0` to *2000-01-15* and `dtick` to *M3*. To set ticks every 4 years, set `dtick` to *M48*
336              
337             =item * exponentformat
338              
339             Determines a formatting rule for the tick exponents. For example, consider the number 1,000,000,000. If *none*, it appears as 1,000,000,000. If *e*, 1e+9. If *E*, 1E+9. If *power*, 1x10^9 (with 9 in a super script). If *SI*, 1G. If *B*, 1B.
340              
341             =item * len
342              
343             Sets the length of the color bar This measure excludes the padding of both ends. That is, the color bar length is this length minus the padding on both ends.
344              
345             =item * lenmode
346              
347             Determines whether this color bar's length (i.e. the measure in the color variation direction) is set in units of plot *fraction* or in *pixels. Use `len` to set the value.
348              
349             =item * nticks
350              
351             Specifies the maximum number of ticks for the particular axis. The actual number of ticks will be chosen automatically to be less than or equal to `nticks`. Has an effect only if `tickmode` is set to *auto*.
352              
353             =item * outlinecolor
354              
355             Sets the axis line color.
356              
357             =item * outlinewidth
358              
359             Sets the width (in px) of the axis line.
360              
361             =item * separatethousands
362              
363             If "true", even 4-digit integers are separated
364              
365             =item * showexponent
366              
367             If *all*, all exponents are shown besides their significands. If *first*, only the exponent of the first tick is shown. If *last*, only the exponent of the last tick is shown. If *none*, no exponents appear.
368              
369             =item * showticklabels
370              
371             Determines whether or not the tick labels are drawn.
372              
373             =item * showtickprefix
374              
375             If *all*, all tick labels are displayed with a prefix. If *first*, only the first tick is displayed with a prefix. If *last*, only the last tick is displayed with a suffix. If *none*, tick prefixes are hidden.
376              
377             =item * showticksuffix
378              
379             Same as `showtickprefix` but for tick suffixes.
380              
381             =item * thickness
382              
383             Sets the thickness of the color bar This measure excludes the size of the padding, ticks and labels.
384              
385             =item * thicknessmode
386              
387             Determines whether this color bar's thickness (i.e. the measure in the constant color direction) is set in units of plot *fraction* or in *pixels*. Use `thickness` to set the value.
388              
389             =item * tick0
390              
391             Sets the placement of the first tick on this axis. Use with `dtick`. If the axis `type` is *log*, then you must take the log of your starting tick (e.g. to set the starting tick to 100, set the `tick0` to 2) except when `dtick`=*L<f>* (see `dtick` for more info). If the axis `type` is *date*, it should be a date string, like date data. If the axis `type` is *category*, it should be a number, using the scale where each category is assigned a serial number from zero in the order it appears.
392              
393             =item * tickangle
394              
395             Sets the angle of the tick labels with respect to the horizontal. For example, a `tickangle` of -90 draws the tick labels vertically.
396              
397             =item * tickcolor
398              
399             Sets the tick color.
400              
401             =item * tickfont
402              
403             =item * tickformat
404              
405             Sets the tick label formatting rule using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-3.x-api-reference/blob/master/Formatting.md#d3_format And for dates see: https://github.com/d3/d3-3.x-api-reference/blob/master/Time-Formatting.md#format We add one item to d3's date formatter: *%{n}f* for fractional seconds with n digits. For example, *2016-10-13 09:15:23.456* with tickformat *%H~%M~%S.%2f* would display *09~15~23.46*
406              
407             =item * tickformatstops
408              
409             =item * ticklen
410              
411             Sets the tick length (in px).
412              
413             =item * tickmode
414              
415             Sets the tick mode for this axis. If *auto*, the number of ticks is set via `nticks`. If *linear*, the placement of the ticks is determined by a starting position `tick0` and a tick step `dtick` (*linear* is the default value if `tick0` and `dtick` are provided). If *array*, the placement of the ticks is set via `tickvals` and the tick text is `ticktext`. (*array* is the default value if `tickvals` is provided).
416              
417             =item * tickprefix
418              
419             Sets a tick label prefix.
420              
421             =item * ticks
422              
423             Determines whether ticks are drawn or not. If **, this axis' ticks are not drawn. If *outside* (*inside*), this axis' are drawn outside (inside) the axis lines.
424              
425             =item * ticksuffix
426              
427             Sets a tick label suffix.
428              
429             =item * ticktext
430              
431             Sets the text displayed at the ticks position via `tickvals`. Only has an effect if `tickmode` is set to *array*. Used with `tickvals`.
432              
433             =item * ticktextsrc
434              
435             Sets the source reference on plot.ly for ticktext .
436              
437             =item * tickvals
438              
439             Sets the values at which ticks on this axis appear. Only has an effect if `tickmode` is set to *array*. Used with `ticktext`.
440              
441             =item * tickvalssrc
442              
443             Sets the source reference on plot.ly for tickvals .
444              
445             =item * tickwidth
446              
447             Sets the tick width (in px).
448              
449             =item * title
450              
451             =item * x
452              
453             Sets the x position of the color bar (in plot fraction).
454              
455             =item * xanchor
456              
457             Sets this color bar's horizontal position anchor. This anchor binds the `x` position to the *left*, *center* or *right* of the color bar.
458              
459             =item * xpad
460              
461             Sets the amount of padding (in px) along the x direction.
462              
463             =item * y
464              
465             Sets the y position of the color bar (in plot fraction).
466              
467             =item * yanchor
468              
469             Sets this color bar's vertical position anchor This anchor binds the `y` position to the *top*, *middle* or *bottom* of the color bar.
470              
471             =item * ypad
472              
473             Sets the amount of padding (in px) along the y direction.
474              
475             =back
476              
477             =head1 AUTHOR
478              
479             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
480              
481             =head1 COPYRIGHT AND LICENSE
482              
483             This software is Copyright (c) 2020 by Pablo Rodríguez González.
484              
485             This is free software, licensed under:
486              
487             The MIT (X11) License
488              
489             =cut