Chart/Plotly/Trace/Carpet.pm untested

filter: Statementstmt 0.0% 0 / 84 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 10 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 121 CC 6 SCAR 28.9
CC
6
Cov
0%
TO_JSON
42.0
type
2.0
BEGIN
2.0
CRAP 18.0
1 package Chart::Plotly::Trace::Carpet;
2 use Moose;
3 use MooseX::ExtraArgs;
4 use Moose::Util::TypeConstraints qw(enum union);
5 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
6 Moose::Util::TypeConstraints::type('PDL');
7 }
8  
9 use Chart::Plotly::Trace::Carpet::Aaxis;
10 use Chart::Plotly::Trace::Carpet::Baxis;
11 use Chart::Plotly::Trace::Carpet::Font;
12 use Chart::Plotly::Trace::Carpet::Legendgrouptitle;
13 use Chart::Plotly::Trace::Carpet::Stream;
14  
15 our $VERSION = '0.042'; # VERSION
16  
17 # ABSTRACT: The data describing carpet axis layout is set in `y` and (optionally) also `x`. If only `y` is present, `x` the plot is interpreted as a cheater plot and is filled in using the `y` values. `x` and `y` may either be 2D arrays matching with each dimension matching that of `a` and `b`, or they may be 1D arrays with total length equal to that of `a` and `b`.
18  
19 sub TO_JSON {
20 my $self = shift;
21 my $extra_args = $self->extra_args // {};
22 my $meta = $self->meta;
23 my %hash = %$self;
24 for my $name ( sort keys %hash ) {
25 my $attr = $meta->get_attribute($name);
26 if ( defined $attr ) {
27 my $value = $hash{$name};
28 my $type = $attr->type_constraint;
29 if ( $type && $type->equals('Bool') ) {
30 $hash{$name} = $value ? \1 : \0;
31 }
32 }
33 }
34 my $plotly_meta = delete $hash{'pmeta'};
35 if ( defined $plotly_meta ) {
36 $hash{'meta'} = $plotly_meta;
37 }
38 %hash = ( %hash, %$extra_args );
39 delete $hash{'extra_args'};
40 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
41 $hash{type} = $self->type();
42 }
43 return \%hash;
44 }
45  
46 sub type {
47 my @components = split( /::/, __PACKAGE__ );
48 return lc( $components[-1] );
49 }
50  
51 has a => ( is => "rw",
52 isa => "ArrayRef|PDL",
53 documentation => "An array containing values of the first parameter value",
54 );
55  
56 has a0 => (
57 is => "rw",
58 isa => "Num",
59 documentation =>
60 "Alternate to `a`. Builds a linear space of a coordinates. Use with `da` where `a0` is the starting coordinate and `da` the step.",
61 );
62  
63 has aaxis => ( is => "rw",
64 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Carpet::Aaxis", );
65  
66 has asrc => ( is => "rw",
67 isa => "Str",
68 documentation => "Sets the source reference on Chart Studio Cloud for `a`.",
69 );
70  
71 has b => ( is => "rw",
72 isa => "ArrayRef|PDL",
73 documentation => "A two dimensional array of y coordinates at each carpet point.",
74 );
75  
76 has b0 => (
77 is => "rw",
78 isa => "Num",
79 documentation =>
80 "Alternate to `b`. Builds a linear space of a coordinates. Use with `db` where `b0` is the starting coordinate and `db` the step.",
81 );
82  
83 has baxis => ( is => "rw",
84 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Carpet::Baxis", );
85  
86 has bsrc => ( is => "rw",
87 isa => "Str",
88 documentation => "Sets the source reference on Chart Studio Cloud for `b`.",
89 );
90  
91 has carpet => (
92 is => "rw",
93 isa => "Str",
94 documentation =>
95 "An identifier for this carpet, so that `scattercarpet` and `contourcarpet` traces can specify a carpet plot on which they lie",
96 );
97  
98 has cheaterslope => (
99 is => "rw",
100 isa => "Num",
101 documentation =>
102 "The shift applied to each successive row of data in creating a cheater plot. Only used if `x` is been omitted.",
103 );
104  
105 has color => (
106 is => "rw",
107 isa => "Str",
108 documentation =>
109 "Sets default for all colors associated with this axis all at once: line, font, tick, and grid colors. Grid color is lightened by blending this with the plot background Individual pieces can override this.",
110 );
111  
112 has customdata => (
113 is => "rw",
114 isa => "ArrayRef|PDL",
115 documentation =>
116 "Assigns extra data each datum. This may be useful when listening to hover, click and selection events. Note that, *scatter* traces also appends customdata items in the markers DOM elements",
117 );
118  
119 has customdatasrc => ( is => "rw",
120 isa => "Str",
121 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
122 );
123  
124 has da => ( is => "rw",
125 isa => "Num",
126 documentation => "Sets the a coordinate step. See `a0` for more info.",
127 );
128  
129 has db => ( is => "rw",
130 isa => "Num",
131 documentation => "Sets the b coordinate step. See `b0` for more info.",
132 );
133  
134 has font => ( is => "rw",
135 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Carpet::Font", );
136  
137 has ids => (
138 is => "rw",
139 isa => "ArrayRef|PDL",
140 documentation =>
141 "Assigns id labels to each datum. These ids for object constancy of data points during animation. Should be an array of strings, not numbers or any other type.",
142 );
143  
144 has idssrc => ( is => "rw",
145 isa => "Str",
146 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
147 );
148  
149 has legendgrouptitle => ( is => "rw",
150 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Carpet::Legendgrouptitle", );
151  
152 has legendrank => (
153 is => "rw",
154 isa => "Num",
155 documentation =>
156 "Sets the legend rank for this trace. Items and groups with smaller ranks are presented on top/left side while with `*reversed* `legend.traceorder` they are on bottom/right side. The default legendrank is 1000, so that you can use ranks less than 1000 to place certain items before all unranked items, and ranks greater than 1000 to go after all unranked items.",
157 );
158  
159 has pmeta => (
160 is => "rw",
161 isa => "Any|ArrayRef[Any]",
162 documentation =>
163 "Assigns extra meta information associated with this trace that can be used in various text attributes. Attributes such as trace `name`, graph, axis and colorbar `title.text`, annotation `text` `rangeselector`, `updatemenues` and `sliders` `label` text all support `meta`. To access the trace `meta` values in an attribute in the same trace, simply use `%{meta[i]}` where `i` is the index or key of the `meta` item in question. To access trace `meta` in layout attributes, use `%{data[n[.meta[i]}` where `i` is the index or key of the `meta` and `n` is the trace index.",
164 );
165  
166 has metasrc => ( is => "rw",
167 isa => "Str",
168 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
169 );
170  
171 has name => ( is => "rw",
172 isa => "Str",
173 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
174 );
175  
176 has opacity => ( is => "rw",
177 isa => "Num",
178 documentation => "Sets the opacity of the trace.",
179 );
180  
181 has stream => ( is => "rw",
182 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Carpet::Stream", );
183  
184 has uid => (
185 is => "rw",
186 isa => "Str",
187 documentation =>
188 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
189 );
190  
191 has uirevision => (
192 is => "rw",
193 isa => "Any",
194 documentation =>
195 "Controls persistence of some user-driven changes to the trace: `constraintrange` in `parcoords` traces, as well as some `editable: true` modifications such as `name` and `colorbar.title`. Defaults to `layout.uirevision`. Note that other user-driven trace attribute changes are controlled by `layout` attributes: `trace.visible` is controlled by `layout.legend.uirevision`, `selectedpoints` is controlled by `layout.selectionrevision`, and `colorbar.(x|y)` (accessible with `config: {editable: true}`) is controlled by `layout.editrevision`. Trace changes are tracked by `uid`, which only falls back on trace index if no `uid` is provided. So if your app can add/remove traces before the end of the `data` array, such that the same trace has a different index, you can still preserve user-driven changes if you give each trace a `uid` that stays with it as it moves.",
196 );
197  
198 has visible => (
199 is => "rw",
200 documentation =>
201 "Determines whether or not this trace is visible. If *legendonly*, the trace is not drawn, but can appear as a legend item (provided that the legend itself is visible).",
202 );
203  
204 has x => (
205 is => "rw",
206 isa => "ArrayRef|PDL",
207 documentation =>
208 "A two dimensional array of x coordinates at each carpet point. If omitted, the plot is a cheater plot and the xaxis is hidden by default.",
209 );
210  
211 has xaxis => (
212 is => "rw",
213 documentation =>
214 "Sets a reference between this trace's x coordinates and a 2D cartesian x axis. If *x* (the default value), the x coordinates refer to `layout.xaxis`. If *x2*, the x coordinates refer to `layout.xaxis2`, and so on.",
215 );
216  
217 has xsrc => ( is => "rw",
218 isa => "Str",
219 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
220 );
221  
222 has y => ( is => "rw",
223 isa => "ArrayRef|PDL",
224 documentation => "A two dimensional array of y coordinates at each carpet point.",
225 );
226  
227 has yaxis => (
228 is => "rw",
229 documentation =>
230 "Sets a reference between this trace's y coordinates and a 2D cartesian y axis. If *y* (the default value), the y coordinates refer to `layout.yaxis`. If *y2*, the y coordinates refer to `layout.yaxis2`, and so on.",
231 );
232  
233 has ysrc => ( is => "rw",
234 isa => "Str",
235 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
236 );
237  
238 __PACKAGE__->meta->make_immutable();
239 1;
240  
241 __END__