Chart/Plotly/Trace/Streamtube.pm untested

filter: Statementstmt 0.0% 0 / 113 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 / 152 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::Streamtube;
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::Streamtube::Colorbar;
10 use Chart::Plotly::Trace::Streamtube::Hoverlabel;
11 use Chart::Plotly::Trace::Streamtube::Legendgrouptitle;
12 use Chart::Plotly::Trace::Streamtube::Lighting;
13 use Chart::Plotly::Trace::Streamtube::Lightposition;
14 use Chart::Plotly::Trace::Streamtube::Starts;
15 use Chart::Plotly::Trace::Streamtube::Stream;
16  
17 our $VERSION = '0.042'; # VERSION
18  
19 # ABSTRACT: Use a streamtube trace to visualize flow in a vector field. Specify a vector field using 6 1D arrays of equal length, 3 position arrays `x`, `y` and `z` and 3 vector component arrays `u`, `v`, and `w`. By default, the tubes' starting positions will be cut from the vector field's x-z plane at its minimum y value. To specify your own starting position, use attributes `starts.x`, `starts.y` and `starts.z`. The color is encoded by the norm of (u, v, w), and the local radius by the divergence of (u, v, w).
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 autocolorscale => (
54 is => "rw",
55 isa => "Bool",
56 documentation =>
57 "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.",
58 );
59  
60 has cauto => (
61 is => "rw",
62 isa => "Bool",
63 documentation =>
64 "Determines whether or not the color domain is computed with respect to the input data (here u/v/w norm) or the bounds set in `cmin` and `cmax` Defaults to `false` when `cmin` and `cmax` are set by the user.",
65 );
66  
67 has cmax => (
68 is => "rw",
69 isa => "Num",
70 documentation =>
71 "Sets the upper bound of the color domain. Value should have the same units as u/v/w norm and if set, `cmin` must be set as well.",
72 );
73  
74 has cmid => (
75 is => "rw",
76 isa => "Num",
77 documentation =>
78 "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 u/v/w norm. Has no effect when `cauto` is `false`.",
79 );
80  
81 has cmin => (
82 is => "rw",
83 isa => "Num",
84 documentation =>
85 "Sets the lower bound of the color domain. Value should have the same units as u/v/w norm and if set, `cmax` must be set as well.",
86 );
87  
88 has coloraxis => (
89 is => "rw",
90 documentation =>
91 "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.",
92 );
93  
94 has colorbar => ( is => "rw",
95 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Streamtube::Colorbar", );
96  
97 has colorscale => (
98 is => "rw",
99 documentation =>
100 "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.",
101 );
102  
103 has customdata => (
104 is => "rw",
105 isa => "ArrayRef|PDL",
106 documentation =>
107 "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",
108 );
109  
110 has customdatasrc => ( is => "rw",
111 isa => "Str",
112 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
113 );
114  
115 has hoverinfo => (
116 is => "rw",
117 isa => "Str|ArrayRef[Str]",
118 documentation =>
119 "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.",
120 );
121  
122 has hoverinfosrc => ( is => "rw",
123 isa => "Str",
124 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
125 );
126  
127 has hoverlabel => ( is => "rw",
128 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Streamtube::Hoverlabel", );
129  
130 has hovertemplate => (
131 is => "rw",
132 isa => "Str|ArrayRef[Str]",
133 documentation =>
134 "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. variables `tubex`, `tubey`, `tubez`, `tubeu`, `tubev`, `tubew`, `norm` and `divergence`. 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>`.",
135 );
136  
137 has hovertemplatesrc => ( is => "rw",
138 isa => "Str",
139 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
140 );
141  
142 has hovertext => ( is => "rw",
143 isa => "Str",
144 documentation => "Same as `text`.",
145 );
146  
147 has ids => (
148 is => "rw",
149 isa => "ArrayRef|PDL",
150 documentation =>
151 "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.",
152 );
153  
154 has idssrc => ( is => "rw",
155 isa => "Str",
156 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
157 );
158  
159 has legendgroup => (
160 is => "rw",
161 isa => "Str",
162 documentation =>
163 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
164 );
165  
166 has legendgrouptitle => ( is => "rw",
167 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Streamtube::Legendgrouptitle", );
168  
169 has legendrank => (
170 is => "rw",
171 isa => "Num",
172 documentation =>
173 "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.",
174 );
175  
176 has lighting => ( is => "rw",
177 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Streamtube::Lighting", );
178  
179 has lightposition => ( is => "rw",
180 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Streamtube::Lightposition", );
181  
182 has maxdisplayed => ( is => "rw",
183 isa => "Int",
184 documentation => "The maximum number of displayed segments in a streamtube.",
185 );
186  
187 has pmeta => (
188 is => "rw",
189 isa => "Any|ArrayRef[Any]",
190 documentation =>
191 "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.",
192 );
193  
194 has metasrc => ( is => "rw",
195 isa => "Str",
196 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
197 );
198  
199 has name => ( is => "rw",
200 isa => "Str",
201 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
202 );
203  
204 has opacity => (
205 is => "rw",
206 isa => "Num",
207 documentation =>
208 "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.",
209 );
210  
211 has reversescale => (
212 is => "rw",
213 isa => "Bool",
214 documentation =>
215 "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.",
216 );
217  
218 has scene => (
219 is => "rw",
220 documentation =>
221 "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.",
222 );
223  
224 has showlegend => (
225 is => "rw",
226 isa => "Bool",
227 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
228 );
229  
230 has showscale => ( is => "rw",
231 isa => "Bool",
232 documentation => "Determines whether or not a colorbar is displayed for this trace.",
233 );
234  
235 has sizeref => (
236 is => "rw",
237 isa => "Num",
238 documentation =>
239 "The scaling factor for the streamtubes. The default is 1, which avoids two max divergence tubes from touching at adjacent starting positions.",
240 );
241  
242 has starts => ( is => "rw",
243 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Streamtube::Starts", );
244  
245 has stream => ( is => "rw",
246 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Streamtube::Stream", );
247  
248 has text => (
249 is => "rw",
250 isa => "Str",
251 documentation =>
252 "Sets a text element associated with this trace. If trace `hoverinfo` contains a *text* flag, this text element will be seen in all hover labels. Note that streamtube traces do not support array `text` values.",
253 );
254  
255 has u => ( is => "rw",
256 isa => "ArrayRef|PDL",
257 documentation => "Sets the x components of the vector field.",
258 );
259  
260 has uhoverformat => (
261 is => "rw",
262 isa => "Str",
263 documentation =>
264 "Sets the hover text formatting rulefor `u` 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.",
265 );
266  
267 has uid => (
268 is => "rw",
269 isa => "Str",
270 documentation =>
271 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
272 );
273  
274 has uirevision => (
275 is => "rw",
276 isa => "Any",
277 documentation =>
278 "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.",
279 );
280  
281 has usrc => ( is => "rw",
282 isa => "Str",
283 documentation => "Sets the source reference on Chart Studio Cloud for `u`.",
284 );
285  
286 has v => ( is => "rw",
287 isa => "ArrayRef|PDL",
288 documentation => "Sets the y components of the vector field.",
289 );
290  
291 has vhoverformat => (
292 is => "rw",
293 isa => "Str",
294 documentation =>
295 "Sets the hover text formatting rulefor `v` 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.",
296 );
297  
298 has visible => (
299 is => "rw",
300 documentation =>
301 "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).",
302 );
303  
304 has vsrc => ( is => "rw",
305 isa => "Str",
306 documentation => "Sets the source reference on Chart Studio Cloud for `v`.",
307 );
308  
309 has w => ( is => "rw",
310 isa => "ArrayRef|PDL",
311 documentation => "Sets the z components of the vector field.",
312 );
313  
314 has whoverformat => (
315 is => "rw",
316 isa => "Str",
317 documentation =>
318 "Sets the hover text formatting rulefor `w` 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.",
319 );
320  
321 has wsrc => ( is => "rw",
322 isa => "Str",
323 documentation => "Sets the source reference on Chart Studio Cloud for `w`.",
324 );
325  
326 has x => ( is => "rw",
327 isa => "ArrayRef|PDL",
328 documentation => "Sets the x coordinates of the vector field.",
329 );
330  
331 has xhoverformat => (
332 is => "rw",
333 isa => "Str",
334 documentation =>
335 "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`.",
336 );
337  
338 has xsrc => ( is => "rw",
339 isa => "Str",
340 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
341 );
342  
343 has y => ( is => "rw",
344 isa => "ArrayRef|PDL",
345 documentation => "Sets the y coordinates of the vector field.",
346 );
347  
348 has yhoverformat => (
349 is => "rw",
350 isa => "Str",
351 documentation =>
352 "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`.",
353 );
354  
355 has ysrc => ( is => "rw",
356 isa => "Str",
357 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
358 );
359  
360 has z => ( is => "rw",
361 isa => "ArrayRef|PDL",
362 documentation => "Sets the z coordinates of the vector field.",
363 );
364  
365 has zhoverformat => (
366 is => "rw",
367 isa => "Str",
368 documentation =>
369 "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`.",
370 );
371  
372 has zsrc => ( is => "rw",
373 isa => "Str",
374 documentation => "Sets the source reference on Chart Studio Cloud for `z`.",
375 );
376  
377 __PACKAGE__->meta->make_immutable();
378 1;
379  
380 __END__