Chart/Plotly/Trace/Isosurface.pm untested

filter: Statementstmt 0.0% 0 / 126 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 16 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 169 CC 6 SCAR 26.0
CC
6
Cov
0%
TO_JSON
42.0
type
2.0
BEGIN
2.0
CRAP 13.4
1 package Chart::Plotly::Trace::Isosurface;
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::Isosurface::Caps;
10 use Chart::Plotly::Trace::Isosurface::Colorbar;
11 use Chart::Plotly::Trace::Isosurface::Contour;
12 use Chart::Plotly::Trace::Isosurface::Hoverlabel;
13 use Chart::Plotly::Trace::Isosurface::Legendgrouptitle;
14 use Chart::Plotly::Trace::Isosurface::Lighting;
15 use Chart::Plotly::Trace::Isosurface::Lightposition;
16 use Chart::Plotly::Trace::Isosurface::Slices;
17 use Chart::Plotly::Trace::Isosurface::Spaceframe;
18 use Chart::Plotly::Trace::Isosurface::Stream;
19 use Chart::Plotly::Trace::Isosurface::Surface;
20  
21 our $VERSION = '0.042'; # VERSION
22  
23 # ABSTRACT: Draws isosurfaces between iso-min and iso-max values with coordinates given by four 1-dimensional arrays containing the `value`, `x`, `y` and `z` of every vertex of a uniform or non-uniform 3-D grid. Horizontal or vertical slices, caps as well as spaceframe between iso-min and iso-max values could also be drawn using this trace.
24  
25 sub TO_JSON {
26 my $self = shift;
27 my $extra_args = $self->extra_args // {};
28 my $meta = $self->meta;
29 my %hash = %$self;
30 for my $name ( sort keys %hash ) {
31 my $attr = $meta->get_attribute($name);
32 if ( defined $attr ) {
33 my $value = $hash{$name};
34 my $type = $attr->type_constraint;
35 if ( $type && $type->equals('Bool') ) {
36 $hash{$name} = $value ? \1 : \0;
37 }
38 }
39 }
40 my $plotly_meta = delete $hash{'pmeta'};
41 if ( defined $plotly_meta ) {
42 $hash{'meta'} = $plotly_meta;
43 }
44 %hash = ( %hash, %$extra_args );
45 delete $hash{'extra_args'};
46 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
47 $hash{type} = $self->type();
48 }
49 return \%hash;
50 }
51  
52 sub type {
53 my @components = split( /::/, __PACKAGE__ );
54 return lc( $components[-1] );
55 }
56  
57 has autocolorscale => (
58 is => "rw",
59 isa => "Bool",
60 documentation =>
61 "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.",
62 );
63  
64 has caps => ( is => "rw",
65 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Caps", );
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 `value`) 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 `value` 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 `value`. 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 `value` and if set, `cmax` must be set as well.",
93 );
94  
95 has coloraxis => (
96 is => "rw",
97 documentation =>
98 "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.",
99 );
100  
101 has colorbar => ( is => "rw",
102 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Colorbar", );
103  
104 has colorscale => (
105 is => "rw",
106 documentation =>
107 "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.",
108 );
109  
110 has contour => ( is => "rw",
111 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Contour", );
112  
113 has customdata => (
114 is => "rw",
115 isa => "ArrayRef|PDL",
116 documentation =>
117 "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",
118 );
119  
120 has customdatasrc => ( is => "rw",
121 isa => "Str",
122 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
123 );
124  
125 has flatshading => (
126 is => "rw",
127 isa => "Bool",
128 documentation =>
129 "Determines whether or not normal smoothing is applied to the meshes, creating meshes with an angular, low-poly look via flat reflections.",
130 );
131  
132 has hoverinfo => (
133 is => "rw",
134 isa => "Str|ArrayRef[Str]",
135 documentation =>
136 "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.",
137 );
138  
139 has hoverinfosrc => ( is => "rw",
140 isa => "Str",
141 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
142 );
143  
144 has hoverlabel => ( is => "rw",
145 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Hoverlabel", );
146  
147 has hovertemplate => (
148 is => "rw",
149 isa => "Str|ArrayRef[Str]",
150 documentation =>
151 "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>`.",
152 );
153  
154 has hovertemplatesrc => ( is => "rw",
155 isa => "Str",
156 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
157 );
158  
159 has hovertext => ( is => "rw",
160 isa => "Str|ArrayRef[Str]",
161 documentation => "Same as `text`.",
162 );
163  
164 has hovertextsrc => ( is => "rw",
165 isa => "Str",
166 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
167 );
168  
169 has ids => (
170 is => "rw",
171 isa => "ArrayRef|PDL",
172 documentation =>
173 "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.",
174 );
175  
176 has idssrc => ( is => "rw",
177 isa => "Str",
178 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
179 );
180  
181 has isomax => ( is => "rw",
182 isa => "Num",
183 documentation => "Sets the maximum boundary for iso-surface plot.",
184 );
185  
186 has isomin => ( is => "rw",
187 isa => "Num",
188 documentation => "Sets the minimum boundary for iso-surface plot.",
189 );
190  
191 has legendgroup => (
192 is => "rw",
193 isa => "Str",
194 documentation =>
195 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
196 );
197  
198 has legendgrouptitle => ( is => "rw",
199 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Legendgrouptitle", );
200  
201 has legendrank => (
202 is => "rw",
203 isa => "Num",
204 documentation =>
205 "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.",
206 );
207  
208 has lighting => ( is => "rw",
209 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Lighting", );
210  
211 has lightposition => ( is => "rw",
212 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Lightposition", );
213  
214 has pmeta => (
215 is => "rw",
216 isa => "Any|ArrayRef[Any]",
217 documentation =>
218 "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.",
219 );
220  
221 has metasrc => ( is => "rw",
222 isa => "Str",
223 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
224 );
225  
226 has name => ( is => "rw",
227 isa => "Str",
228 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
229 );
230  
231 has opacity => (
232 is => "rw",
233 isa => "Num",
234 documentation =>
235 "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.",
236 );
237  
238 has reversescale => (
239 is => "rw",
240 isa => "Bool",
241 documentation =>
242 "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.",
243 );
244  
245 has scene => (
246 is => "rw",
247 documentation =>
248 "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.",
249 );
250  
251 has showlegend => (
252 is => "rw",
253 isa => "Bool",
254 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
255 );
256  
257 has showscale => ( is => "rw",
258 isa => "Bool",
259 documentation => "Determines whether or not a colorbar is displayed for this trace.",
260 );
261  
262 has slices => ( is => "rw",
263 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Slices", );
264  
265 has spaceframe => ( is => "rw",
266 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Spaceframe", );
267  
268 has stream => ( is => "rw",
269 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Stream", );
270  
271 has surface => ( is => "rw",
272 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Isosurface::Surface", );
273  
274 has text => (
275 is => "rw",
276 isa => "Str|ArrayRef[Str]",
277 documentation =>
278 "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.",
279 );
280  
281 has textsrc => ( is => "rw",
282 isa => "Str",
283 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
284 );
285  
286 has uid => (
287 is => "rw",
288 isa => "Str",
289 documentation =>
290 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
291 );
292  
293 has uirevision => (
294 is => "rw",
295 isa => "Any",
296 documentation =>
297 "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.",
298 );
299  
300 has value => ( is => "rw",
301 isa => "ArrayRef|PDL",
302 documentation => "Sets the 4th dimension (value) of the vertices.",
303 );
304  
305 has valuehoverformat => (
306 is => "rw",
307 isa => "Str",
308 documentation =>
309 "Sets the hover text formatting rulefor `value` 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.By default the values are formatted using generic number format.",
310 );
311  
312 has valuesrc => ( is => "rw",
313 isa => "Str",
314 documentation => "Sets the source reference on Chart Studio Cloud for `value`.",
315 );
316  
317 has visible => (
318 is => "rw",
319 documentation =>
320 "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).",
321 );
322  
323 has x => ( is => "rw",
324 isa => "ArrayRef|PDL",
325 documentation => "Sets the X coordinates of the vertices on X axis.",
326 );
327  
328 has xhoverformat => (
329 is => "rw",
330 isa => "Str",
331 documentation =>
332 "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`.",
333 );
334  
335 has xsrc => ( is => "rw",
336 isa => "Str",
337 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
338 );
339  
340 has y => ( is => "rw",
341 isa => "ArrayRef|PDL",
342 documentation => "Sets the Y coordinates of the vertices on Y axis.",
343 );
344  
345 has yhoverformat => (
346 is => "rw",
347 isa => "Str",
348 documentation =>
349 "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`.",
350 );
351  
352 has ysrc => ( is => "rw",
353 isa => "Str",
354 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
355 );
356  
357 has z => ( is => "rw",
358 isa => "ArrayRef|PDL",
359 documentation => "Sets the Z coordinates of the vertices on Z axis.",
360 );
361  
362 has zhoverformat => (
363 is => "rw",
364 isa => "Str",
365 documentation =>
366 "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`.",
367 );
368  
369 has zsrc => ( is => "rw",
370 isa => "Str",
371 documentation => "Sets the source reference on Chart Studio Cloud for `z`.",
372 );
373  
374 __PACKAGE__->meta->make_immutable();
375 1;
376  
377 __END__