Chart/Plotly/Trace/Cone.pm untested

filter: Statementstmt 0.0% 0 / 116 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 154 CC 6 SCAR 28.3
CC
6
Cov
0%
TO_JSON
42.0
type
2.0
BEGIN
2.0
CRAP 17.0
1 package Chart::Plotly::Trace::Cone;
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::Cone::Colorbar;
10 use Chart::Plotly::Trace::Cone::Hoverlabel;
11 use Chart::Plotly::Trace::Cone::Legendgrouptitle;
12 use Chart::Plotly::Trace::Cone::Lighting;
13 use Chart::Plotly::Trace::Cone::Lightposition;
14 use Chart::Plotly::Trace::Cone::Stream;
15  
16 our $VERSION = '0.042'; # VERSION
17  
18 # ABSTRACT: Use cone traces to visualize vector fields. Specify a vector field using 6 1D arrays, 3 position arrays `x`, `y` and `z` and 3 vector component arrays `u`, `v`, `w`. The cones are drawn exactly at the positions given by `x`, `y` and `z`.
19  
20 sub TO_JSON {
21 my $self = shift;
22 my $extra_args = $self->extra_args // {};
23 my $meta = $self->meta;
24 my %hash = %$self;
25 for my $name ( sort keys %hash ) {
26 my $attr = $meta->get_attribute($name);
27 if ( defined $attr ) {
28 my $value = $hash{$name};
29 my $type = $attr->type_constraint;
30 if ( $type && $type->equals('Bool') ) {
31 $hash{$name} = $value ? \1 : \0;
32 }
33 }
34 }
35 my $plotly_meta = delete $hash{'pmeta'};
36 if ( defined $plotly_meta ) {
37 $hash{'meta'} = $plotly_meta;
38 }
39 %hash = ( %hash, %$extra_args );
40 delete $hash{'extra_args'};
41 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
42 $hash{type} = $self->type();
43 }
44 return \%hash;
45 }
46  
47 sub type {
48 my @components = split( /::/, __PACKAGE__ );
49 return lc( $components[-1] );
50 }
51  
52 has anchor => (
53 is => "rw",
54 isa => enum( [ "tip", "tail", "cm", "center" ] ),
55 documentation =>
56 "Sets the cones' anchor with respect to their x/y/z positions. Note that *cm* denote the cone's center of mass which corresponds to 1/4 from the tail to tip.",
57 );
58  
59 has autocolorscale => (
60 is => "rw",
61 isa => "Bool",
62 documentation =>
63 "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.",
64 );
65  
66 has cauto => (
67 is => "rw",
68 isa => "Bool",
69 documentation =>
70 "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.",
71 );
72  
73 has cmax => (
74 is => "rw",
75 isa => "Num",
76 documentation =>
77 "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.",
78 );
79  
80 has cmid => (
81 is => "rw",
82 isa => "Num",
83 documentation =>
84 "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`.",
85 );
86  
87 has cmin => (
88 is => "rw",
89 isa => "Num",
90 documentation =>
91 "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.",
92 );
93  
94 has coloraxis => (
95 is => "rw",
96 documentation =>
97 "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.",
98 );
99  
100 has colorbar => ( is => "rw",
101 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Cone::Colorbar", );
102  
103 has colorscale => (
104 is => "rw",
105 documentation =>
106 "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.",
107 );
108  
109 has customdata => (
110 is => "rw",
111 isa => "ArrayRef|PDL",
112 documentation =>
113 "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",
114 );
115  
116 has customdatasrc => ( is => "rw",
117 isa => "Str",
118 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
119 );
120  
121 has hoverinfo => (
122 is => "rw",
123 isa => "Str|ArrayRef[Str]",
124 documentation =>
125 "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.",
126 );
127  
128 has hoverinfosrc => ( is => "rw",
129 isa => "Str",
130 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
131 );
132  
133 has hoverlabel => ( is => "rw",
134 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Cone::Hoverlabel", );
135  
136 has hovertemplate => (
137 is => "rw",
138 isa => "Str|ArrayRef[Str]",
139 documentation =>
140 "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. variable `norm` 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>`.",
141 );
142  
143 has hovertemplatesrc => ( is => "rw",
144 isa => "Str",
145 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
146 );
147  
148 has hovertext => ( is => "rw",
149 isa => "Str|ArrayRef[Str]",
150 documentation => "Same as `text`.",
151 );
152  
153 has hovertextsrc => ( is => "rw",
154 isa => "Str",
155 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
156 );
157  
158 has ids => (
159 is => "rw",
160 isa => "ArrayRef|PDL",
161 documentation =>
162 "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.",
163 );
164  
165 has idssrc => ( is => "rw",
166 isa => "Str",
167 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
168 );
169  
170 has legendgroup => (
171 is => "rw",
172 isa => "Str",
173 documentation =>
174 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
175 );
176  
177 has legendgrouptitle => ( is => "rw",
178 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Cone::Legendgrouptitle", );
179  
180 has legendrank => (
181 is => "rw",
182 isa => "Num",
183 documentation =>
184 "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.",
185 );
186  
187 has lighting => ( is => "rw",
188 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Cone::Lighting", );
189  
190 has lightposition => ( is => "rw",
191 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Cone::Lightposition", );
192  
193 has pmeta => (
194 is => "rw",
195 isa => "Any|ArrayRef[Any]",
196 documentation =>
197 "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.",
198 );
199  
200 has metasrc => ( is => "rw",
201 isa => "Str",
202 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
203 );
204  
205 has name => ( is => "rw",
206 isa => "Str",
207 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
208 );
209  
210 has opacity => (
211 is => "rw",
212 isa => "Num",
213 documentation =>
214 "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.",
215 );
216  
217 has reversescale => (
218 is => "rw",
219 isa => "Bool",
220 documentation =>
221 "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.",
222 );
223  
224 has scene => (
225 is => "rw",
226 documentation =>
227 "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.",
228 );
229  
230 has showlegend => (
231 is => "rw",
232 isa => "Bool",
233 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
234 );
235  
236 has showscale => ( is => "rw",
237 isa => "Bool",
238 documentation => "Determines whether or not a colorbar is displayed for this trace.",
239 );
240  
241 has sizemode => (
242 is => "rw",
243 isa => enum( [ "scaled", "absolute" ] ),
244 documentation =>
245 "Determines whether `sizeref` is set as a *scaled* (i.e unitless) scalar (normalized by the max u/v/w norm in the vector field) or as *absolute* value (in the same units as the vector field).",
246 );
247  
248 has sizeref => (
249 is => "rw",
250 isa => "Num",
251 documentation =>
252 "Adjusts the cone size scaling. The size of the cones is determined by their u/v/w norm multiplied a factor and `sizeref`. This factor (computed internally) corresponds to the minimum \"time\" to travel across two successive x/y/z positions at the average velocity of those two successive positions. All cones in a given trace use the same factor. With `sizemode` set to *scaled*, `sizeref` is unitless, its default value is *0.5* With `sizemode` set to *absolute*, `sizeref` has the same units as the u/v/w vector field, its the default value is half the sample's maximum vector norm.",
253 );
254  
255 has stream => ( is => "rw",
256 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Cone::Stream", );
257  
258 has text => (
259 is => "rw",
260 isa => "Str|ArrayRef[Str]",
261 documentation =>
262 "Sets the text elements associated with the cones. If trace `hoverinfo` contains a *text* flag and *hovertext* is not set, these elements will be seen in the hover labels.",
263 );
264  
265 has textsrc => ( is => "rw",
266 isa => "Str",
267 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
268 );
269  
270 has u => ( is => "rw",
271 isa => "ArrayRef|PDL",
272 documentation => "Sets the x components of the vector field.",
273 );
274  
275 has uhoverformat => (
276 is => "rw",
277 isa => "Str",
278 documentation =>
279 "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.",
280 );
281  
282 has uid => (
283 is => "rw",
284 isa => "Str",
285 documentation =>
286 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
287 );
288  
289 has uirevision => (
290 is => "rw",
291 isa => "Any",
292 documentation =>
293 "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.",
294 );
295  
296 has usrc => ( is => "rw",
297 isa => "Str",
298 documentation => "Sets the source reference on Chart Studio Cloud for `u`.",
299 );
300  
301 has v => ( is => "rw",
302 isa => "ArrayRef|PDL",
303 documentation => "Sets the y components of the vector field.",
304 );
305  
306 has vhoverformat => (
307 is => "rw",
308 isa => "Str",
309 documentation =>
310 "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.",
311 );
312  
313 has visible => (
314 is => "rw",
315 documentation =>
316 "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).",
317 );
318  
319 has vsrc => ( is => "rw",
320 isa => "Str",
321 documentation => "Sets the source reference on Chart Studio Cloud for `v`.",
322 );
323  
324 has w => ( is => "rw",
325 isa => "ArrayRef|PDL",
326 documentation => "Sets the z components of the vector field.",
327 );
328  
329 has whoverformat => (
330 is => "rw",
331 isa => "Str",
332 documentation =>
333 "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.",
334 );
335  
336 has wsrc => ( is => "rw",
337 isa => "Str",
338 documentation => "Sets the source reference on Chart Studio Cloud for `w`.",
339 );
340  
341 has x => ( is => "rw",
342 isa => "ArrayRef|PDL",
343 documentation => "Sets the x coordinates of the vector field and of the displayed cones.",
344 );
345  
346 has xhoverformat => (
347 is => "rw",
348 isa => "Str",
349 documentation =>
350 "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`.",
351 );
352  
353 has xsrc => ( is => "rw",
354 isa => "Str",
355 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
356 );
357  
358 has y => ( is => "rw",
359 isa => "ArrayRef|PDL",
360 documentation => "Sets the y coordinates of the vector field and of the displayed cones.",
361 );
362  
363 has yhoverformat => (
364 is => "rw",
365 isa => "Str",
366 documentation =>
367 "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`.",
368 );
369  
370 has ysrc => ( is => "rw",
371 isa => "Str",
372 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
373 );
374  
375 has z => ( is => "rw",
376 isa => "ArrayRef|PDL",
377 documentation => "Sets the z coordinates of the vector field and of the displayed cones.",
378 );
379  
380 has zhoverformat => (
381 is => "rw",
382 isa => "Str",
383 documentation =>
384 "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`.",
385 );
386  
387 has zsrc => ( is => "rw",
388 isa => "Str",
389 documentation => "Sets the source reference on Chart Studio Cloud for `z`.",
390 );
391  
392 __PACKAGE__->meta->make_immutable();
393 1;
394  
395 __END__