Chart/Plotly/Trace/Contourcarpet.pm untested

filter: Statementstmt 0.0% 0 / 105 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 / 142 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::Contourcarpet;
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::Contourcarpet::Colorbar;
10 use Chart::Plotly::Trace::Contourcarpet::Contours;
11 use Chart::Plotly::Trace::Contourcarpet::Legendgrouptitle;
12 use Chart::Plotly::Trace::Contourcarpet::Line;
13 use Chart::Plotly::Trace::Contourcarpet::Stream;
14  
15 our $VERSION = '0.042'; # VERSION
16  
17 # ABSTRACT: Plots contours on either the first carpet axis or the carpet axis with a matching `carpet` attribute. Data `z` is interpreted as matching that of the corresponding carpet axis.
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 => "Sets the x coordinates.",
54 );
55  
56 has a0 => (
57 is => "rw",
58 isa => "Any",
59 documentation =>
60 "Alternate to `x`. Builds a linear space of x coordinates. Use with `dx` where `x0` is the starting coordinate and `dx` the step.",
61 );
62  
63 has asrc => ( is => "rw",
64 isa => "Str",
65 documentation => "Sets the source reference on Chart Studio Cloud for `a`.",
66 );
67  
68 has atype => (
69 is => "rw",
70 isa => enum( [ "array", "scaled" ] ),
71 documentation =>
72 "If *array*, the heatmap's x coordinates are given by *x* (the default behavior when `x` is provided). If *scaled*, the heatmap's x coordinates are given by *x0* and *dx* (the default behavior when `x` is not provided).",
73 );
74  
75 has autocolorscale => (
76 is => "rw",
77 isa => "Bool",
78 documentation =>
79 "Determines whether the colorscale is a default palette (`autocolorscale: true`) or the palette determined by `colorscale`. 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.",
80 );
81  
82 has autocontour => (
83 is => "rw",
84 isa => "Bool",
85 documentation =>
86 "Determines whether or not the contour level attributes are picked by an algorithm. If *true*, the number of contour levels can be set in `ncontours`. If *false*, set the contour level attributes in `contours`.",
87 );
88  
89 has b => ( is => "rw",
90 isa => "ArrayRef|PDL",
91 documentation => "Sets the y coordinates.",
92 );
93  
94 has b0 => (
95 is => "rw",
96 isa => "Any",
97 documentation =>
98 "Alternate to `y`. Builds a linear space of y coordinates. Use with `dy` where `y0` is the starting coordinate and `dy` the step.",
99 );
100  
101 has bsrc => ( is => "rw",
102 isa => "Str",
103 documentation => "Sets the source reference on Chart Studio Cloud for `b`.",
104 );
105  
106 has btype => (
107 is => "rw",
108 isa => enum( [ "array", "scaled" ] ),
109 documentation =>
110 "If *array*, the heatmap's y coordinates are given by *y* (the default behavior when `y` is provided) If *scaled*, the heatmap's y coordinates are given by *y0* and *dy* (the default behavior when `y` is not provided)",
111 );
112  
113 has carpet => ( is => "rw",
114 isa => "Str",
115 documentation => "The `carpet` of the carpet axes on which this contour trace lies",
116 );
117  
118 has coloraxis => (
119 is => "rw",
120 documentation =>
121 "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.",
122 );
123  
124 has colorbar => ( is => "rw",
125 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Contourcarpet::Colorbar", );
126  
127 has colorscale => (
128 is => "rw",
129 documentation =>
130 "Sets the colorscale. 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 `zmin` and `zmax`. 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.",
131 );
132  
133 has contours => ( is => "rw",
134 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Contourcarpet::Contours", );
135  
136 has customdata => (
137 is => "rw",
138 isa => "ArrayRef|PDL",
139 documentation =>
140 "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",
141 );
142  
143 has customdatasrc => ( is => "rw",
144 isa => "Str",
145 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
146 );
147  
148 has da => ( is => "rw",
149 isa => "Num",
150 documentation => "Sets the x coordinate step. See `x0` for more info.",
151 );
152  
153 has db => ( is => "rw",
154 isa => "Num",
155 documentation => "Sets the y coordinate step. See `y0` for more info.",
156 );
157  
158 has fillcolor => (
159 is => "rw",
160 isa => "Str",
161 documentation =>
162 "Sets the fill color if `contours.type` is *constraint*. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
163 );
164  
165 has hovertext => ( is => "rw",
166 isa => "ArrayRef|PDL",
167 documentation => "Same as `text`.",
168 );
169  
170 has hovertextsrc => ( is => "rw",
171 isa => "Str",
172 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
173 );
174  
175 has ids => (
176 is => "rw",
177 isa => "ArrayRef|PDL",
178 documentation =>
179 "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.",
180 );
181  
182 has idssrc => ( is => "rw",
183 isa => "Str",
184 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
185 );
186  
187 has legendgroup => (
188 is => "rw",
189 isa => "Str",
190 documentation =>
191 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
192 );
193  
194 has legendgrouptitle => ( is => "rw",
195 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Contourcarpet::Legendgrouptitle", );
196  
197 has legendrank => (
198 is => "rw",
199 isa => "Num",
200 documentation =>
201 "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.",
202 );
203  
204 has line => ( is => "rw",
205 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Contourcarpet::Line", );
206  
207 has pmeta => (
208 is => "rw",
209 isa => "Any|ArrayRef[Any]",
210 documentation =>
211 "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.",
212 );
213  
214 has metasrc => ( is => "rw",
215 isa => "Str",
216 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
217 );
218  
219 has name => ( is => "rw",
220 isa => "Str",
221 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
222 );
223  
224 has ncontours => (
225 is => "rw",
226 isa => "Int",
227 documentation =>
228 "Sets the maximum number of contour levels. The actual number of contours will be chosen automatically to be less than or equal to the value of `ncontours`. Has an effect only if `autocontour` is *true* or if `contours.size` is missing.",
229 );
230  
231 has opacity => ( is => "rw",
232 isa => "Num",
233 documentation => "Sets the opacity of the trace.",
234 );
235  
236 has reversescale => (
237 is => "rw",
238 isa => "Bool",
239 documentation =>
240 "Reverses the color mapping if true. If true, `zmin` will correspond to the last color in the array and `zmax` will correspond to the first color.",
241 );
242  
243 has showlegend => (
244 is => "rw",
245 isa => "Bool",
246 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
247 );
248  
249 has showscale => ( is => "rw",
250 isa => "Bool",
251 documentation => "Determines whether or not a colorbar is displayed for this trace.",
252 );
253  
254 has stream => ( is => "rw",
255 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Contourcarpet::Stream", );
256  
257 has text => ( is => "rw",
258 isa => "ArrayRef|PDL",
259 documentation => "Sets the text elements associated with each z value.",
260 );
261  
262 has textsrc => ( is => "rw",
263 isa => "Str",
264 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
265 );
266  
267 has transpose => ( is => "rw",
268 isa => "Bool",
269 documentation => "Transposes the z data.",
270 );
271  
272 has uid => (
273 is => "rw",
274 isa => "Str",
275 documentation =>
276 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
277 );
278  
279 has uirevision => (
280 is => "rw",
281 isa => "Any",
282 documentation =>
283 "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.",
284 );
285  
286 has visible => (
287 is => "rw",
288 documentation =>
289 "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).",
290 );
291  
292 has xaxis => (
293 is => "rw",
294 documentation =>
295 "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.",
296 );
297  
298 has yaxis => (
299 is => "rw",
300 documentation =>
301 "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.",
302 );
303  
304 has z => ( is => "rw",
305 isa => "ArrayRef|PDL",
306 documentation => "Sets the z data.",
307 );
308  
309 has zauto => (
310 is => "rw",
311 isa => "Bool",
312 documentation =>
313 "Determines whether or not the color domain is computed with respect to the input data (here in `z`) or the bounds set in `zmin` and `zmax` Defaults to `false` when `zmin` and `zmax` are set by the user.",
314 );
315  
316 has zmax => (
317 is => "rw",
318 isa => "Num",
319 documentation =>
320 "Sets the upper bound of the color domain. Value should have the same units as in `z` and if set, `zmin` must be set as well.",
321 );
322  
323 has zmid => (
324 is => "rw",
325 isa => "Num",
326 documentation =>
327 "Sets the mid-point of the color domain by scaling `zmin` and/or `zmax` to be equidistant to this point. Value should have the same units as in `z`. Has no effect when `zauto` is `false`.",
328 );
329  
330 has zmin => (
331 is => "rw",
332 isa => "Num",
333 documentation =>
334 "Sets the lower bound of the color domain. Value should have the same units as in `z` and if set, `zmax` must be set as well.",
335 );
336  
337 has zsrc => ( is => "rw",
338 isa => "Str",
339 documentation => "Sets the source reference on Chart Studio Cloud for `z`.",
340 );
341  
342 __PACKAGE__->meta->make_immutable();
343 1;
344  
345 __END__