Chart/Plotly/Trace/Volume.pm untested

filter: Statementstmt 0.0% 0 / 127 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 / 170 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::Volume;
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::Volume::Caps;
10 use Chart::Plotly::Trace::Volume::Colorbar;
11 use Chart::Plotly::Trace::Volume::Contour;
12 use Chart::Plotly::Trace::Volume::Hoverlabel;
13 use Chart::Plotly::Trace::Volume::Legendgrouptitle;
14 use Chart::Plotly::Trace::Volume::Lighting;
15 use Chart::Plotly::Trace::Volume::Lightposition;
16 use Chart::Plotly::Trace::Volume::Slices;
17 use Chart::Plotly::Trace::Volume::Spaceframe;
18 use Chart::Plotly::Trace::Volume::Stream;
19 use Chart::Plotly::Trace::Volume::Surface;
20  
21 our $VERSION = '0.042'; # VERSION
22  
23 # ABSTRACT: Draws volume trace 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::Volume::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::Volume::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::Volume::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::Volume::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::Volume::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::Volume::Lighting", );
210  
211 has lightposition => ( is => "rw",
212 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Volume::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 opacityscale => (
239 is => "rw",
240 isa => "Any",
241 documentation =>
242 "Sets the opacityscale. The opacityscale must be an array containing arrays mapping a normalized value to an opacity value. At minimum, a mapping for the lowest (0) and highest (1) values are required. For example, `[[0, 1], [0.5, 0.2], [1, 1]]` means that higher/lower values would have higher opacity values and those in the middle would be more transparent Alternatively, `opacityscale` may be a palette name string of the following list: 'min', 'max', 'extremes' and 'uniform'. The default is 'uniform'.",
243 );
244  
245 has reversescale => (
246 is => "rw",
247 isa => "Bool",
248 documentation =>
249 "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.",
250 );
251  
252 has scene => (
253 is => "rw",
254 documentation =>
255 "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.",
256 );
257  
258 has showlegend => (
259 is => "rw",
260 isa => "Bool",
261 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
262 );
263  
264 has showscale => ( is => "rw",
265 isa => "Bool",
266 documentation => "Determines whether or not a colorbar is displayed for this trace.",
267 );
268  
269 has slices => ( is => "rw",
270 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Volume::Slices", );
271  
272 has spaceframe => ( is => "rw",
273 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Volume::Spaceframe", );
274  
275 has stream => ( is => "rw",
276 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Volume::Stream", );
277  
278 has surface => ( is => "rw",
279 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Volume::Surface", );
280  
281 has text => (
282 is => "rw",
283 isa => "Str|ArrayRef[Str]",
284 documentation =>
285 "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.",
286 );
287  
288 has textsrc => ( is => "rw",
289 isa => "Str",
290 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
291 );
292  
293 has uid => (
294 is => "rw",
295 isa => "Str",
296 documentation =>
297 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
298 );
299  
300 has uirevision => (
301 is => "rw",
302 isa => "Any",
303 documentation =>
304 "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.",
305 );
306  
307 has value => ( is => "rw",
308 isa => "ArrayRef|PDL",
309 documentation => "Sets the 4th dimension (value) of the vertices.",
310 );
311  
312 has valuehoverformat => (
313 is => "rw",
314 isa => "Str",
315 documentation =>
316 "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.",
317 );
318  
319 has valuesrc => ( is => "rw",
320 isa => "Str",
321 documentation => "Sets the source reference on Chart Studio Cloud for `value`.",
322 );
323  
324 has visible => (
325 is => "rw",
326 documentation =>
327 "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).",
328 );
329  
330 has x => ( is => "rw",
331 isa => "ArrayRef|PDL",
332 documentation => "Sets the X coordinates of the vertices on X axis.",
333 );
334  
335 has xhoverformat => (
336 is => "rw",
337 isa => "Str",
338 documentation =>
339 "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`.",
340 );
341  
342 has xsrc => ( is => "rw",
343 isa => "Str",
344 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
345 );
346  
347 has y => ( is => "rw",
348 isa => "ArrayRef|PDL",
349 documentation => "Sets the Y coordinates of the vertices on Y axis.",
350 );
351  
352 has yhoverformat => (
353 is => "rw",
354 isa => "Str",
355 documentation =>
356 "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`.",
357 );
358  
359 has ysrc => ( is => "rw",
360 isa => "Str",
361 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
362 );
363  
364 has z => ( is => "rw",
365 isa => "ArrayRef|PDL",
366 documentation => "Sets the Z coordinates of the vertices on Z axis.",
367 );
368  
369 has zhoverformat => (
370 is => "rw",
371 isa => "Str",
372 documentation =>
373 "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`.",
374 );
375  
376 has zsrc => ( is => "rw",
377 isa => "Str",
378 documentation => "Sets the source reference on Chart Studio Cloud for `z`.",
379 );
380  
381 __PACKAGE__->meta->make_immutable();
382 1;
383  
384 __END__