Chart/Plotly/Trace/Scattergl.pm untested

filter: Statementstmt 0.0% 0 / 144 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 / 187 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::Scattergl;
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::Scattergl::Error_x;
10 use Chart::Plotly::Trace::Scattergl::Error_y;
11 use Chart::Plotly::Trace::Scattergl::Hoverlabel;
12 use Chart::Plotly::Trace::Scattergl::Legendgrouptitle;
13 use Chart::Plotly::Trace::Scattergl::Line;
14 use Chart::Plotly::Trace::Scattergl::Marker;
15 use Chart::Plotly::Trace::Scattergl::Selected;
16 use Chart::Plotly::Trace::Scattergl::Stream;
17 use Chart::Plotly::Trace::Scattergl::Textfont;
18 use Chart::Plotly::Trace::Scattergl::Transform;
19 use Chart::Plotly::Trace::Scattergl::Unselected;
20  
21 our $VERSION = '0.042'; # VERSION
22  
23 # ABSTRACT: The data visualized as scatter point or lines is set in `x` and `y` using the WebGL plotting engine. Bubble charts are achieved by setting `marker.size` and/or `marker.color` to a numerical arrays.
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 connectgaps => (
58 is => "rw",
59 isa => "Bool",
60 documentation =>
61 "Determines whether or not gaps (i.e. {nan} or missing values) in the provided data arrays are connected.",
62 );
63  
64 has customdata => (
65 is => "rw",
66 isa => "ArrayRef|PDL",
67 documentation =>
68 "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",
69 );
70  
71 has customdatasrc => ( is => "rw",
72 isa => "Str",
73 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
74 );
75  
76 has dx => ( is => "rw",
77 isa => "Num",
78 documentation => "Sets the x coordinate step. See `x0` for more info.",
79 );
80  
81 has dy => ( is => "rw",
82 isa => "Num",
83 documentation => "Sets the y coordinate step. See `y0` for more info.",
84 );
85  
86 has error_x => ( is => "rw",
87 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Error_x", );
88  
89 has error_y => ( is => "rw",
90 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Error_y", );
91  
92 has fill => (
93 is => "rw",
94 isa => enum( [ "none", "tozeroy", "tozerox", "tonexty", "tonextx", "toself", "tonext" ] ),
95 documentation =>
96 "Sets the area to fill with a solid color. Defaults to *none* unless this trace is stacked, then it gets *tonexty* (*tonextx*) if `orientation` is *v* (*h*) Use with `fillcolor` if not *none*. *tozerox* and *tozeroy* fill to x=0 and y=0 respectively. *tonextx* and *tonexty* fill between the endpoints of this trace and the endpoints of the trace before it, connecting those endpoints with straight lines (to make a stacked area graph); if there is no trace before it, they behave like *tozerox* and *tozeroy*. *toself* connects the endpoints of the trace (or each segment of the trace if it has gaps) into a closed shape. *tonext* fills the space between two traces if one completely encloses the other (eg consecutive contour lines), and behaves like *toself* if there is no trace before it. *tonext* should not be used if one trace does not enclose the other. Traces in a `stackgroup` will only fill to (or be filled to) other traces in the same group. With multiple `stackgroup`s or some traces stacked and some not, if fill-linked traces are not already consecutive, the later ones will be pushed down in the drawing order.",
97 );
98  
99 has fillcolor => (
100 is => "rw",
101 isa => "Str",
102 documentation =>
103 "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
104 );
105  
106 has hoverinfo => (
107 is => "rw",
108 isa => "Str|ArrayRef[Str]",
109 documentation =>
110 "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.",
111 );
112  
113 has hoverinfosrc => ( is => "rw",
114 isa => "Str",
115 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
116 );
117  
118 has hoverlabel => ( is => "rw",
119 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Hoverlabel", );
120  
121 has hovertemplate => (
122 is => "rw",
123 isa => "Str|ArrayRef[Str]",
124 documentation =>
125 "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>`.",
126 );
127  
128 has hovertemplatesrc => ( is => "rw",
129 isa => "Str",
130 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
131 );
132  
133 has hovertext => (
134 is => "rw",
135 isa => "Str|ArrayRef[Str]",
136 documentation =>
137 "Sets hover text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. To be seen, trace `hoverinfo` must contain a *text* flag.",
138 );
139  
140 has hovertextsrc => ( is => "rw",
141 isa => "Str",
142 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
143 );
144  
145 has ids => (
146 is => "rw",
147 isa => "ArrayRef|PDL",
148 documentation =>
149 "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.",
150 );
151  
152 has idssrc => ( is => "rw",
153 isa => "Str",
154 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
155 );
156  
157 has legendgroup => (
158 is => "rw",
159 isa => "Str",
160 documentation =>
161 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
162 );
163  
164 has legendgrouptitle => ( is => "rw",
165 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Legendgrouptitle", );
166  
167 has legendrank => (
168 is => "rw",
169 isa => "Num",
170 documentation =>
171 "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.",
172 );
173  
174 has line => ( is => "rw",
175 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Line", );
176  
177 has marker => ( is => "rw",
178 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Marker", );
179  
180 has pmeta => (
181 is => "rw",
182 isa => "Any|ArrayRef[Any]",
183 documentation =>
184 "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.",
185 );
186  
187 has metasrc => ( is => "rw",
188 isa => "Str",
189 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
190 );
191  
192 has mode => ( is => "rw",
193 isa => "Str",
194 documentation => "Determines the drawing mode for this scatter trace.",
195 );
196  
197 has name => ( is => "rw",
198 isa => "Str",
199 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
200 );
201  
202 has opacity => ( is => "rw",
203 isa => "Num",
204 documentation => "Sets the opacity of the trace.",
205 );
206  
207 has selected => ( is => "rw",
208 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Selected", );
209  
210 has selectedpoints => (
211 is => "rw",
212 isa => "Any",
213 documentation =>
214 "Array containing integer indices of selected points. Has an effect only for traces that support selections. Note that an empty array means an empty selection where the `unselected` are turned on for all points, whereas, any other non-array values means no selection all where the `selected` and `unselected` styles have no effect.",
215 );
216  
217 has showlegend => (
218 is => "rw",
219 isa => "Bool",
220 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
221 );
222  
223 has stream => ( is => "rw",
224 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Stream", );
225  
226 has text => (
227 is => "rw",
228 isa => "Str|ArrayRef[Str]",
229 documentation =>
230 "Sets text elements associated with each (x,y) pair. If a single string, the same string appears over all the data points. If an array of string, the items are mapped in order to the this trace's (x,y) coordinates. If trace `hoverinfo` contains a *text* flag and *hovertext* is not set, these elements will be seen in the hover labels.",
231 );
232  
233 has textfont => ( is => "rw",
234 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Textfont", );
235  
236 has textposition => (
237 is => "rw",
238 isa => union(
239 [
240 enum(
241 [ "top left",
242 "top center",
243 "top right",
244 "middle left",
245 "middle center",
246 "middle right",
247 "bottom left",
248 "bottom center",
249 "bottom right"
250 ]
251 ),
252 "ArrayRef"
253 ]
254 ),
255 documentation => "Sets the positions of the `text` elements with respects to the (x,y) coordinates.",
256 );
257  
258 has textpositionsrc => ( is => "rw",
259 isa => "Str",
260 documentation => "Sets the source reference on Chart Studio Cloud for `textposition`.",
261 );
262  
263 has textsrc => ( is => "rw",
264 isa => "Str",
265 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
266 );
267  
268 has texttemplate => (
269 is => "rw",
270 isa => "Str|ArrayRef[Str]",
271 documentation =>
272 "Template string used for rendering the information text that appear on points. Note that this will override `textinfo`. Variables are inserted using %{variable}, for example \"y: %{y}\". 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. Every attributes that can be specified per-point (the ones that are `arrayOk: true`) are available. ",
273 );
274  
275 has texttemplatesrc => ( is => "rw",
276 isa => "Str",
277 documentation => "Sets the source reference on Chart Studio Cloud for `texttemplate`.",
278 );
279  
280 has transforms => ( is => "rw",
281 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Scattergl::Transform]", );
282  
283 has uid => (
284 is => "rw",
285 isa => "Str",
286 documentation =>
287 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
288 );
289  
290 has uirevision => (
291 is => "rw",
292 isa => "Any",
293 documentation =>
294 "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.",
295 );
296  
297 has unselected => ( is => "rw",
298 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattergl::Unselected", );
299  
300 has visible => (
301 is => "rw",
302 documentation =>
303 "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).",
304 );
305  
306 has x => ( is => "rw",
307 isa => "ArrayRef|PDL",
308 documentation => "Sets the x coordinates.",
309 );
310  
311 has x0 => (
312 is => "rw",
313 isa => "Any",
314 documentation =>
315 "Alternate to `x`. Builds a linear space of x coordinates. Use with `dx` where `x0` is the starting coordinate and `dx` the step.",
316 );
317  
318 has xaxis => (
319 is => "rw",
320 documentation =>
321 "Sets a reference between this trace's x coordinates and a 2D cartesian x axis. If *x* (the default value), the x coordinates refer to `layout.xaxis`. If *x2*, the x coordinates refer to `layout.xaxis2`, and so on.",
322 );
323  
324 has xcalendar => ( is => "rw",
325 isa => enum(
326 [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
327 "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
328 ]
329 ),
330 documentation => "Sets the calendar system to use with `x` date data.",
331 );
332  
333 has xhoverformat => (
334 is => "rw",
335 isa => "Str",
336 documentation =>
337 "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`.",
338 );
339  
340 has xperiod => (
341 is => "rw",
342 isa => "Any",
343 documentation =>
344 "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *n* on the x axis. Special values in the form of *n* could be used to declare the number of months. In this case `n` must be a positive integer.",
345 );
346  
347 has xperiod0 => (
348 is => "rw",
349 isa => "Any",
350 documentation =>
351 "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the x0 axis. When `x0period` is round number of weeks, the `x0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01.",
352 );
353  
354 has xperiodalignment => (
355 is => "rw",
356 isa => enum( [ "start", "middle", "end" ] ),
357 documentation => "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis.",
358 );
359  
360 has xsrc => ( is => "rw",
361 isa => "Str",
362 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
363 );
364  
365 has y => ( is => "rw",
366 isa => "ArrayRef|PDL",
367 documentation => "Sets the y coordinates.",
368 );
369  
370 has y0 => (
371 is => "rw",
372 isa => "Any",
373 documentation =>
374 "Alternate to `y`. Builds a linear space of y coordinates. Use with `dy` where `y0` is the starting coordinate and `dy` the step.",
375 );
376  
377 has yaxis => (
378 is => "rw",
379 documentation =>
380 "Sets a reference between this trace's y coordinates and a 2D cartesian y axis. If *y* (the default value), the y coordinates refer to `layout.yaxis`. If *y2*, the y coordinates refer to `layout.yaxis2`, and so on.",
381 );
382  
383 has ycalendar => ( is => "rw",
384 isa => enum(
385 [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
386 "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
387 ]
388 ),
389 documentation => "Sets the calendar system to use with `y` date data.",
390 );
391  
392 has yhoverformat => (
393 is => "rw",
394 isa => "Str",
395 documentation =>
396 "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`.",
397 );
398  
399 has yperiod => (
400 is => "rw",
401 isa => "Any",
402 documentation =>
403 "Only relevant when the axis `type` is *date*. Sets the period positioning in milliseconds or *n* on the y axis. Special values in the form of *n* could be used to declare the number of months. In this case `n` must be a positive integer.",
404 );
405  
406 has yperiod0 => (
407 is => "rw",
408 isa => "Any",
409 documentation =>
410 "Only relevant when the axis `type` is *date*. Sets the base for period positioning in milliseconds or date string on the y0 axis. When `y0period` is round number of weeks, the `y0period0` by default would be on a Sunday i.e. 2000-01-02, otherwise it would be at 2000-01-01.",
411 );
412  
413 has yperiodalignment => (
414 is => "rw",
415 isa => enum( [ "start", "middle", "end" ] ),
416 documentation => "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis.",
417 );
418  
419 has ysrc => ( is => "rw",
420 isa => "Str",
421 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
422 );
423  
424 __PACKAGE__->meta->make_immutable();
425 1;
426  
427 __END__