Chart/Plotly/Trace/Mesh3d.pm untested

filter: Statementstmt 0.0% 0 / 134 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 12 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 173 CC 6 SCAR 27.8
CC
6
Cov
0%
TO_JSON
42.0
type
2.0
BEGIN
2.0
CRAP 16.1
1 package Chart::Plotly::Trace::Mesh3d;
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::Mesh3d::Colorbar;
10 use Chart::Plotly::Trace::Mesh3d::Contour;
11 use Chart::Plotly::Trace::Mesh3d::Hoverlabel;
12 use Chart::Plotly::Trace::Mesh3d::Legendgrouptitle;
13 use Chart::Plotly::Trace::Mesh3d::Lighting;
14 use Chart::Plotly::Trace::Mesh3d::Lightposition;
15 use Chart::Plotly::Trace::Mesh3d::Stream;
16  
17 our $VERSION = '0.042'; # VERSION
18  
19 # ABSTRACT: Draws sets of triangles with coordinates given by three 1-dimensional arrays in `x`, `y`, `z` and (1) a sets of `i`, `j`, `k` indices (2) Delaunay triangulation or (3) the Alpha-shape algorithm or (4) the Convex-hull algorithm
20  
21 sub TO_JSON {
22 my $self = shift;
23 my $extra_args = $self->extra_args // {};
24 my $meta = $self->meta;
25 my %hash = %$self;
26 for my $name ( sort keys %hash ) {
27 my $attr = $meta->get_attribute($name);
28 if ( defined $attr ) {
29 my $value = $hash{$name};
30 my $type = $attr->type_constraint;
31 if ( $type && $type->equals('Bool') ) {
32 $hash{$name} = $value ? \1 : \0;
33 }
34 }
35 }
36 my $plotly_meta = delete $hash{'pmeta'};
37 if ( defined $plotly_meta ) {
38 $hash{'meta'} = $plotly_meta;
39 }
40 %hash = ( %hash, %$extra_args );
41 delete $hash{'extra_args'};
42 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
43 $hash{type} = $self->type();
44 }
45 return \%hash;
46 }
47  
48 sub type {
49 my @components = split( /::/, __PACKAGE__ );
50 return lc( $components[-1] );
51 }
52  
53 has alphahull => (
54 is => "rw",
55 isa => "Num",
56 documentation =>
57 "Determines how the mesh surface triangles are derived from the set of vertices (points) represented by the `x`, `y` and `z` arrays, if the `i`, `j`, `k` arrays are not supplied. For general use of `mesh3d` it is preferred that `i`, `j`, `k` are supplied. If *-1*, Delaunay triangulation is used, which is mainly suitable if the mesh is a single, more or less layer surface that is perpendicular to `delaunayaxis`. In case the `delaunayaxis` intersects the mesh surface at more than one point it will result triangles that are very long in the dimension of `delaunayaxis`. If *>0*, the alpha-shape algorithm is used. In this case, the positive `alphahull` value signals the use of the alpha-shape algorithm, _and_ its value acts as the parameter for the mesh fitting. If *0*, the convex-hull algorithm is used. It is suitable for convex bodies or if the intention is to enclose the `x`, `y` and `z` point set into a convex hull.",
58 );
59  
60 has autocolorscale => (
61 is => "rw",
62 isa => "Bool",
63 documentation =>
64 "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.",
65 );
66  
67 has cauto => (
68 is => "rw",
69 isa => "Bool",
70 documentation =>
71 "Determines whether or not the color domain is computed with respect to the input data (here `intensity`) or the bounds set in `cmin` and `cmax` Defaults to `false` when `cmin` and `cmax` are set by the user.",
72 );
73  
74 has cmax => (
75 is => "rw",
76 isa => "Num",
77 documentation =>
78 "Sets the upper bound of the color domain. Value should have the same units as `intensity` and if set, `cmin` must be set as well.",
79 );
80  
81 has cmid => (
82 is => "rw",
83 isa => "Num",
84 documentation =>
85 "Sets the mid-point of the color domain by scaling `cmin` and/or `cmax` to be equidistant to this point. Value should have the same units as `intensity`. Has no effect when `cauto` is `false`.",
86 );
87  
88 has cmin => (
89 is => "rw",
90 isa => "Num",
91 documentation =>
92 "Sets the lower bound of the color domain. Value should have the same units as `intensity` and if set, `cmax` must be set as well.",
93 );
94  
95 has color => ( is => "rw",
96 isa => "Str",
97 documentation => "Sets the color of the whole mesh",
98 );
99  
100 has coloraxis => (
101 is => "rw",
102 documentation =>
103 "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.",
104 );
105  
106 has colorbar => ( is => "rw",
107 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Mesh3d::Colorbar", );
108  
109 has colorscale => (
110 is => "rw",
111 documentation =>
112 "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 `cmin` and `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.",
113 );
114  
115 has contour => ( is => "rw",
116 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Mesh3d::Contour", );
117  
118 has customdata => (
119 is => "rw",
120 isa => "ArrayRef|PDL",
121 documentation =>
122 "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",
123 );
124  
125 has customdatasrc => ( is => "rw",
126 isa => "Str",
127 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
128 );
129  
130 has delaunayaxis => (
131 is => "rw",
132 isa => enum( [ "x", "y", "z" ] ),
133 documentation =>
134 "Sets the Delaunay axis, which is the axis that is perpendicular to the surface of the Delaunay triangulation. It has an effect if `i`, `j`, `k` are not provided and `alphahull` is set to indicate Delaunay triangulation.",
135 );
136  
137 has facecolor => ( is => "rw",
138 isa => "ArrayRef|PDL",
139 documentation => "Sets the color of each face Overrides *color* and *vertexcolor*.",
140 );
141  
142 has facecolorsrc => ( is => "rw",
143 isa => "Str",
144 documentation => "Sets the source reference on Chart Studio Cloud for `facecolor`.",
145 );
146  
147 has flatshading => (
148 is => "rw",
149 isa => "Bool",
150 documentation =>
151 "Determines whether or not normal smoothing is applied to the meshes, creating meshes with an angular, low-poly look via flat reflections.",
152 );
153  
154 has hoverinfo => (
155 is => "rw",
156 isa => "Str|ArrayRef[Str]",
157 documentation =>
158 "Determines which trace information appear on hover. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired.",
159 );
160  
161 has hoverinfosrc => ( is => "rw",
162 isa => "Str",
163 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
164 );
165  
166 has hoverlabel => ( is => "rw",
167 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Mesh3d::Hoverlabel", );
168  
169 has hovertemplate => (
170 is => "rw",
171 isa => "Str|ArrayRef[Str]",
172 documentation =>
173 "Template string used for rendering the information that appear on hover box. Note that this will override `hoverinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\" as well as %{xother}, {%_xother}, {%_xother_}, {%xother_}. When showing info for several points, *xother* will be added to those with different x positions from the first point. An underscore before or after *(x|y)other* will add a space on that side, only when this field is shown. Numbers are formatted using d3-format's syntax %{variable:d3-format}, for example \"Price: %{y:\$.2f}\". https://github.com/d3/d3-format/tree/v1.4.5#d3-format for details on the formatting syntax. Dates are formatted using d3-time-format's syntax %{variable|d3-time-format}, for example \"Day: %{2019-01-01|%A}\". https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format for details on the date formatting syntax. The variables available in `hovertemplate` are the ones emitted as event data described at this link https://plotly.com/javascript/plotlyjs-events/#event-data. Additionally, every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. Anything contained in tag `<extra>` is displayed in the secondary box, for example \"<extra>{fullData.name}</extra>\". To hide the secondary box completely, use an empty tag `<extra></extra>`.",
174 );
175  
176 has hovertemplatesrc => ( is => "rw",
177 isa => "Str",
178 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
179 );
180  
181 has hovertext => ( is => "rw",
182 isa => "Str|ArrayRef[Str]",
183 documentation => "Same as `text`.",
184 );
185  
186 has hovertextsrc => ( is => "rw",
187 isa => "Str",
188 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
189 );
190  
191 has i => (
192 is => "rw",
193 isa => "ArrayRef|PDL",
194 documentation =>
195 "A vector of vertex indices, i.e. integer values between 0 and the length of the vertex vectors, representing the *first* vertex of a triangle. For example, `{i[m], j[m], k[m]}` together represent face m (triangle m) in the mesh, where `i[m] = n` points to the triplet `{x[n], y[n], z[n]}` in the vertex arrays. Therefore, each element in `i` represents a point in space, which is the first vertex of a triangle.",
196 );
197  
198 has ids => (
199 is => "rw",
200 isa => "ArrayRef|PDL",
201 documentation =>
202 "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.",
203 );
204  
205 has idssrc => ( is => "rw",
206 isa => "Str",
207 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
208 );
209  
210 has intensity => (
211 is => "rw",
212 isa => "ArrayRef|PDL",
213 documentation =>
214 "Sets the intensity values for vertices or cells as defined by `intensitymode`. It can be used for plotting fields on meshes.",
215 );
216  
217 has intensitymode => ( is => "rw",
218 isa => enum( [ "vertex", "cell" ] ),
219 documentation => "Determines the source of `intensity` values.",
220 );
221  
222 has intensitysrc => ( is => "rw",
223 isa => "Str",
224 documentation => "Sets the source reference on Chart Studio Cloud for `intensity`.",
225 );
226  
227 has isrc => ( is => "rw",
228 isa => "Str",
229 documentation => "Sets the source reference on Chart Studio Cloud for `i`.",
230 );
231  
232 has j => (
233 is => "rw",
234 isa => "ArrayRef|PDL",
235 documentation =>
236 "A vector of vertex indices, i.e. integer values between 0 and the length of the vertex vectors, representing the *second* vertex of a triangle. For example, `{i[m], j[m], k[m]}` together represent face m (triangle m) in the mesh, where `j[m] = n` points to the triplet `{x[n], y[n], z[n]}` in the vertex arrays. Therefore, each element in `j` represents a point in space, which is the second vertex of a triangle.",
237 );
238  
239 has jsrc => ( is => "rw",
240 isa => "Str",
241 documentation => "Sets the source reference on Chart Studio Cloud for `j`.",
242 );
243  
244 has k => (
245 is => "rw",
246 isa => "ArrayRef|PDL",
247 documentation =>
248 "A vector of vertex indices, i.e. integer values between 0 and the length of the vertex vectors, representing the *third* vertex of a triangle. For example, `{i[m], j[m], k[m]}` together represent face m (triangle m) in the mesh, where `k[m] = n` points to the triplet `{x[n], y[n], z[n]}` in the vertex arrays. Therefore, each element in `k` represents a point in space, which is the third vertex of a triangle.",
249 );
250  
251 has ksrc => ( is => "rw",
252 isa => "Str",
253 documentation => "Sets the source reference on Chart Studio Cloud for `k`.",
254 );
255  
256 has legendgroup => (
257 is => "rw",
258 isa => "Str",
259 documentation =>
260 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
261 );
262  
263 has legendgrouptitle => ( is => "rw",
264 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Mesh3d::Legendgrouptitle", );
265  
266 has legendrank => (
267 is => "rw",
268 isa => "Num",
269 documentation =>
270 "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.",
271 );
272  
273 has lighting => ( is => "rw",
274 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Mesh3d::Lighting", );
275  
276 has lightposition => ( is => "rw",
277 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Mesh3d::Lightposition", );
278  
279 has pmeta => (
280 is => "rw",
281 isa => "Any|ArrayRef[Any]",
282 documentation =>
283 "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.",
284 );
285  
286 has metasrc => ( is => "rw",
287 isa => "Str",
288 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
289 );
290  
291 has name => ( is => "rw",
292 isa => "Str",
293 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
294 );
295  
296 has opacity => (
297 is => "rw",
298 isa => "Num",
299 documentation =>
300 "Sets the opacity of the surface. Please note that in the case of using high `opacity` values for example a value greater than or equal to 0.5 on two surfaces (and 0.25 with four surfaces), an overlay of multiple transparent surfaces may not perfectly be sorted in depth by the webgl API. This behavior may be improved in the near future and is subject to change.",
301 );
302  
303 has reversescale => (
304 is => "rw",
305 isa => "Bool",
306 documentation =>
307 "Reverses the color mapping if true. If true, `cmin` will correspond to the last color in the array and `cmax` will correspond to the first color.",
308 );
309  
310 has scene => (
311 is => "rw",
312 documentation =>
313 "Sets a reference between this trace's 3D coordinate system and a 3D scene. If *scene* (the default value), the (x,y,z) coordinates refer to `layout.scene`. If *scene2*, the (x,y,z) coordinates refer to `layout.scene2`, and so on.",
314 );
315  
316 has showlegend => (
317 is => "rw",
318 isa => "Bool",
319 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
320 );
321  
322 has showscale => ( is => "rw",
323 isa => "Bool",
324 documentation => "Determines whether or not a colorbar is displayed for this trace.",
325 );
326  
327 has stream => ( is => "rw",
328 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Mesh3d::Stream", );
329  
330 has text => (
331 is => "rw",
332 isa => "Str|ArrayRef[Str]",
333 documentation =>
334 "Sets the text elements associated with the vertices. If trace `hoverinfo` contains a *text* flag and *hovertext* is not set, these elements will be seen in the hover labels.",
335 );
336  
337 has textsrc => ( is => "rw",
338 isa => "Str",
339 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
340 );
341  
342 has uid => (
343 is => "rw",
344 isa => "Str",
345 documentation =>
346 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
347 );
348  
349 has uirevision => (
350 is => "rw",
351 isa => "Any",
352 documentation =>
353 "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.",
354 );
355  
356 has vertexcolor => (
357 is => "rw",
358 isa => "ArrayRef|PDL",
359 documentation =>
360 "Sets the color of each vertex Overrides *color*. While Red, green and blue colors are in the range of 0 and 255; in the case of having vertex color data in RGBA format, the alpha color should be normalized to be between 0 and 1.",
361 );
362  
363 has vertexcolorsrc => ( is => "rw",
364 isa => "Str",
365 documentation => "Sets the source reference on Chart Studio Cloud for `vertexcolor`.",
366 );
367  
368 has visible => (
369 is => "rw",
370 documentation =>
371 "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).",
372 );
373  
374 has x => (
375 is => "rw",
376 isa => "ArrayRef|PDL",
377 documentation =>
378 "Sets the X coordinates of the vertices. The nth element of vectors `x`, `y` and `z` jointly represent the X, Y and Z coordinates of the nth vertex.",
379 );
380  
381 has xcalendar => ( is => "rw",
382 isa => enum(
383 [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
384 "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
385 ]
386 ),
387 documentation => "Sets the calendar system to use with `x` date data.",
388 );
389  
390 has xhoverformat => (
391 is => "rw",
392 isa => "Str",
393 documentation =>
394 "Sets the hover text formatting rulefor `x` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: *%h* for half of the year as a decimal number as well as *%{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*By default the values are formatted using `xaxis.hoverformat`.",
395 );
396  
397 has xsrc => ( is => "rw",
398 isa => "Str",
399 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
400 );
401  
402 has y => (
403 is => "rw",
404 isa => "ArrayRef|PDL",
405 documentation =>
406 "Sets the Y coordinates of the vertices. The nth element of vectors `x`, `y` and `z` jointly represent the X, Y and Z coordinates of the nth vertex.",
407 );
408  
409 has ycalendar => ( is => "rw",
410 isa => enum(
411 [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
412 "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
413 ]
414 ),
415 documentation => "Sets the calendar system to use with `y` date data.",
416 );
417  
418 has yhoverformat => (
419 is => "rw",
420 isa => "Str",
421 documentation =>
422 "Sets the hover text formatting rulefor `y` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: *%h* for half of the year as a decimal number as well as *%{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*By default the values are formatted using `yaxis.hoverformat`.",
423 );
424  
425 has ysrc => ( is => "rw",
426 isa => "Str",
427 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
428 );
429  
430 has z => (
431 is => "rw",
432 isa => "ArrayRef|PDL",
433 documentation =>
434 "Sets the Z coordinates of the vertices. The nth element of vectors `x`, `y` and `z` jointly represent the X, Y and Z coordinates of the nth vertex.",
435 );
436  
437 has zcalendar => ( is => "rw",
438 isa => enum(
439 [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
440 "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
441 ]
442 ),
443 documentation => "Sets the calendar system to use with `z` date data.",
444 );
445  
446 has zhoverformat => (
447 is => "rw",
448 isa => "Str",
449 documentation =>
450 "Sets the hover text formatting rulefor `z` using d3 formatting mini-languages which are very similar to those in Python. For numbers, see: https://github.com/d3/d3-format/tree/v1.4.5#d3-format. And for dates see: https://github.com/d3/d3-time-format/tree/v2.2.3#locale_format. We add two items to d3's date formatter: *%h* for half of the year as a decimal number as well as *%{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*By default the values are formatted using `zaxis.hoverformat`.",
451 );
452  
453 has zsrc => ( is => "rw",
454 isa => "Str",
455 documentation => "Sets the source reference on Chart Studio Cloud for `z`.",
456 );
457  
458 __PACKAGE__->meta->make_immutable();
459 1;
460  
461 __END__