Chart/Plotly/Trace/Surface.pm untested

filter: Statementstmt 0.0% 0 / 118 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 / 157 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::Surface;
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::Surface::Colorbar;
10 use Chart::Plotly::Trace::Surface::Contours;
11 use Chart::Plotly::Trace::Surface::Hoverlabel;
12 use Chart::Plotly::Trace::Surface::Legendgrouptitle;
13 use Chart::Plotly::Trace::Surface::Lighting;
14 use Chart::Plotly::Trace::Surface::Lightposition;
15 use Chart::Plotly::Trace::Surface::Stream;
16  
17 our $VERSION = '0.042'; # VERSION
18  
19 # ABSTRACT: The data the describes the coordinates of the surface is set in `z`. Data in `z` should be a {2D array}. Coordinates in `x` and `y` can either be 1D {arrays} or {2D arrays} (e.g. to graph parametric surfaces). If not provided in `x` and `y`, the x and y coordinates are assumed to be linear starting at 0 with a unit step. The color scale corresponds to the `z` values by default. For custom color scales, use `surfacecolor` which should be a {2D array}, where its bounds can be controlled using `cmin` and `cmax`.
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 z or surfacecolor) 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 z or surfacecolor 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 z or surfacecolor. 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 z or surfacecolor 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::Surface::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 connectgaps => (
104 is => "rw",
105 isa => "Bool",
106 documentation => "Determines whether or not gaps (i.e. {nan} or missing values) in the `z` data are filled in.",
107 );
108  
109 has contours => ( is => "rw",
110 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Surface::Contours", );
111  
112 has customdata => (
113 is => "rw",
114 isa => "ArrayRef|PDL",
115 documentation =>
116 "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",
117 );
118  
119 has customdatasrc => ( is => "rw",
120 isa => "Str",
121 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
122 );
123  
124 has hidesurface => (
125 is => "rw",
126 isa => "Bool",
127 documentation =>
128 "Determines whether or not a surface is drawn. For example, set `hidesurface` to *false* `contours.x.show` to *true* and `contours.y.show` to *true* to draw a wire frame plot.",
129 );
130  
131 has hoverinfo => (
132 is => "rw",
133 isa => "Str|ArrayRef[Str]",
134 documentation =>
135 "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.",
136 );
137  
138 has hoverinfosrc => ( is => "rw",
139 isa => "Str",
140 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
141 );
142  
143 has hoverlabel => ( is => "rw",
144 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Surface::Hoverlabel", );
145  
146 has hovertemplate => (
147 is => "rw",
148 isa => "Str|ArrayRef[Str]",
149 documentation =>
150 "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>`.",
151 );
152  
153 has hovertemplatesrc => ( is => "rw",
154 isa => "Str",
155 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
156 );
157  
158 has hovertext => ( is => "rw",
159 isa => "Str|ArrayRef[Str]",
160 documentation => "Same as `text`.",
161 );
162  
163 has hovertextsrc => ( is => "rw",
164 isa => "Str",
165 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
166 );
167  
168 has ids => (
169 is => "rw",
170 isa => "ArrayRef|PDL",
171 documentation =>
172 "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.",
173 );
174  
175 has idssrc => ( is => "rw",
176 isa => "Str",
177 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
178 );
179  
180 has legendgroup => (
181 is => "rw",
182 isa => "Str",
183 documentation =>
184 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
185 );
186  
187 has legendgrouptitle => ( is => "rw",
188 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Surface::Legendgrouptitle", );
189  
190 has legendrank => (
191 is => "rw",
192 isa => "Num",
193 documentation =>
194 "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.",
195 );
196  
197 has lighting => ( is => "rw",
198 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Surface::Lighting", );
199  
200 has lightposition => ( is => "rw",
201 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Surface::Lightposition", );
202  
203 has pmeta => (
204 is => "rw",
205 isa => "Any|ArrayRef[Any]",
206 documentation =>
207 "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.",
208 );
209  
210 has metasrc => ( is => "rw",
211 isa => "Str",
212 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
213 );
214  
215 has name => ( is => "rw",
216 isa => "Str",
217 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
218 );
219  
220 has opacity => (
221 is => "rw",
222 isa => "Num",
223 documentation =>
224 "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.",
225 );
226  
227 has opacityscale => (
228 is => "rw",
229 isa => "Any",
230 documentation =>
231 "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'.",
232 );
233  
234 has reversescale => (
235 is => "rw",
236 isa => "Bool",
237 documentation =>
238 "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.",
239 );
240  
241 has scene => (
242 is => "rw",
243 documentation =>
244 "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.",
245 );
246  
247 has showlegend => (
248 is => "rw",
249 isa => "Bool",
250 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
251 );
252  
253 has showscale => ( is => "rw",
254 isa => "Bool",
255 documentation => "Determines whether or not a colorbar is displayed for this trace.",
256 );
257  
258 has stream => ( is => "rw",
259 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Surface::Stream", );
260  
261 has surfacecolor => (
262 is => "rw",
263 isa => "ArrayRef|PDL",
264 documentation => "Sets the surface color values, used for setting a color scale independent of `z`.",
265 );
266  
267 has surfacecolorsrc => ( is => "rw",
268 isa => "Str",
269 documentation => "Sets the source reference on Chart Studio Cloud for `surfacecolor`.",
270 );
271  
272 has text => (
273 is => "rw",
274 isa => "Str|ArrayRef[Str]",
275 documentation =>
276 "Sets the text elements associated with each z value. If trace `hoverinfo` contains a *text* flag and *hovertext* is not set, these elements will be seen in the hover labels.",
277 );
278  
279 has textsrc => ( is => "rw",
280 isa => "Str",
281 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
282 );
283  
284 has uid => (
285 is => "rw",
286 isa => "Str",
287 documentation =>
288 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
289 );
290  
291 has uirevision => (
292 is => "rw",
293 isa => "Any",
294 documentation =>
295 "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.",
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 x => ( is => "rw",
305 isa => "ArrayRef|PDL",
306 documentation => "Sets the x coordinates.",
307 );
308  
309 has xcalendar => ( is => "rw",
310 isa => enum(
311 [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
312 "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
313 ]
314 ),
315 documentation => "Sets the calendar system to use with `x` date data.",
316 );
317  
318 has xhoverformat => (
319 is => "rw",
320 isa => "Str",
321 documentation =>
322 "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`.",
323 );
324  
325 has xsrc => ( is => "rw",
326 isa => "Str",
327 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
328 );
329  
330 has y => ( is => "rw",
331 isa => "ArrayRef|PDL",
332 documentation => "Sets the y coordinates.",
333 );
334  
335 has ycalendar => ( is => "rw",
336 isa => enum(
337 [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
338 "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
339 ]
340 ),
341 documentation => "Sets the calendar system to use with `y` date data.",
342 );
343  
344 has yhoverformat => (
345 is => "rw",
346 isa => "Str",
347 documentation =>
348 "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`.",
349 );
350  
351 has ysrc => ( is => "rw",
352 isa => "Str",
353 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
354 );
355  
356 has z => ( is => "rw",
357 isa => "ArrayRef|PDL",
358 documentation => "Sets the z coordinates.",
359 );
360  
361 has zcalendar => ( is => "rw",
362 isa => enum(
363 [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
364 "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
365 ]
366 ),
367 documentation => "Sets the calendar system to use with `z` date data.",
368 );
369  
370 has zhoverformat => (
371 is => "rw",
372 isa => "Str",
373 documentation =>
374 "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`.",
375 );
376  
377 has zsrc => ( is => "rw",
378 isa => "Str",
379 documentation => "Sets the source reference on Chart Studio Cloud for `z`.",
380 );
381  
382 __PACKAGE__->meta->make_immutable();
383 1;
384  
385 __END__