File Coverage

blib/lib/Chart/Plotly/Trace/Scatter.pm
Criterion Covered Total %
statement 64 66 96.9
branch 5 10 50.0
condition 3 8 37.5
subroutine 17 17 100.0
pod 2 2 100.0
total 91 103 88.3


line stmt bran cond sub pod time code
1             use Moose;
2 4     4   92062 use MooseX::ExtraArgs;
  4         404093  
  4         31  
3 4     4   23958 use Moose::Util::TypeConstraints qw(enum union);
  4         2666  
  4         15  
4 4     4   58013 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
  4         8  
  4         27  
5             Moose::Util::TypeConstraints::type('PDL');
6             }
7              
8             use Chart::Plotly::Trace::Scatter::Error_x;
9 4     4   4097 use Chart::Plotly::Trace::Scatter::Error_y;
  4         16  
  4         154  
10 4     4   2085 use Chart::Plotly::Trace::Scatter::Fillpattern;
  4         12  
  4         137  
11 4     4   1837 use Chart::Plotly::Trace::Scatter::Hoverlabel;
  4         42  
  4         139  
12 4     4   1924 use Chart::Plotly::Trace::Scatter::Legendgrouptitle;
  4         15  
  4         186  
13 4     4   1974 use Chart::Plotly::Trace::Scatter::Line;
  4         12  
  4         140  
14 4     4   2056 use Chart::Plotly::Trace::Scatter::Marker;
  4         12  
  4         131  
15 4     4   2009 use Chart::Plotly::Trace::Scatter::Selected;
  4         15  
  4         174  
16 4     4   2085 use Chart::Plotly::Trace::Scatter::Stream;
  4         15  
  4         151  
17 4     4   2088 use Chart::Plotly::Trace::Scatter::Textfont;
  4         11  
  4         150  
18 4     4   2126 use Chart::Plotly::Trace::Scatter::Transform;
  4         14  
  4         157  
19 4     4   1993 use Chart::Plotly::Trace::Scatter::Unselected;
  4         12  
  4         158  
20 4     4   2006  
  4         15  
  4         5323  
21             our $VERSION = '0.042'; # VERSION
22              
23             # ABSTRACT: The scatter trace type encompasses line charts, scatter charts, text charts, and bubble charts. The data visualized as scatter point or lines is set in `x` and `y`. Text (appearing either on the chart or on hover only) is via `text`. Bubble charts are achieved by setting `marker.size` and/or `marker.color` to numerical arrays.
24              
25             my $self = shift;
26             my $extra_args = $self->extra_args // {};
27 4     4 1 1399823 my $meta = $self->meta;
28 4   50     232 my %hash = %$self;
29 4         101 for my $name ( sort keys %hash ) {
30 4         268 my $attr = $meta->get_attribute($name);
31 4         46 if ( defined $attr ) {
32 12         910 my $value = $hash{$name};
33 12 100       141 my $type = $attr->type_constraint;
34 8         36 if ( $type && $type->equals('Bool') ) {
35 8         353 $hash{$name} = $value ? \1 : \0;
36 8 50 33     290 }
37 0 0       0 }
38             }
39             my $plotly_meta = delete $hash{'pmeta'};
40             if ( defined $plotly_meta ) {
41 4         326 $hash{'meta'} = $plotly_meta;
42 4 50       24 }
43 0         0 %hash = ( %hash, %$extra_args );
44             delete $hash{'extra_args'};
45 4         27 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
46 4         19 $hash{type} = $self->type();
47 4 50 33     69 }
48 4         33 return \%hash;
49             }
50 4         92  
51             my @components = split( /::/, __PACKAGE__ );
52             return lc( $components[-1] );
53             }
54 4     4 1 33  
55 4         31 has cliponaxis => (
56             is => "rw",
57             isa => "Bool",
58             documentation =>
59             "Determines whether or not markers and text nodes are clipped about the subplot axes. To show markers and text nodes above axis lines and tick labels, make sure to set `xaxis.layer` and `yaxis.layer` to *below traces*.",
60             );
61              
62             has connectgaps => (
63             is => "rw",
64             isa => "Bool",
65             documentation =>
66             "Determines whether or not gaps (i.e. {nan} or missing values) in the provided data arrays are connected.",
67             );
68              
69             has customdata => (
70             is => "rw",
71             isa => "ArrayRef|PDL",
72             documentation =>
73             "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",
74             );
75              
76             has customdatasrc => ( is => "rw",
77             isa => "Str",
78             documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
79             );
80              
81             has dx => ( is => "rw",
82             isa => "Num",
83             documentation => "Sets the x coordinate step. See `x0` for more info.",
84             );
85              
86             has dy => ( is => "rw",
87             isa => "Num",
88             documentation => "Sets the y coordinate step. See `y0` for more info.",
89             );
90              
91             has error_x => ( is => "rw",
92             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Error_x", );
93              
94             has error_y => ( is => "rw",
95             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Error_y", );
96              
97             has fill => (
98             is => "rw",
99             isa => enum( [ "none", "tozeroy", "tozerox", "tonexty", "tonextx", "toself", "tonext" ] ),
100             documentation =>
101             "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.",
102             );
103              
104             has fillcolor => (
105             is => "rw",
106             isa => "Str",
107             documentation =>
108             "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
109             );
110              
111             has fillpattern => ( is => "rw",
112             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Fillpattern", );
113              
114             has groupnorm => (
115             is => "rw",
116             isa => enum( [ "", "fraction", "percent" ] ),
117             documentation =>
118             "Only relevant when `stackgroup` is used, and only the first `groupnorm` found in the `stackgroup` will be used - including if `visible` is *legendonly* but not if it is `false`. Sets the normalization for the sum of this `stackgroup`. With *fraction*, the value of each trace at each location is divided by the sum of all trace values at that location. *percent* is the same but multiplied by 100 to show percentages. If there are multiple subplots, or multiple `stackgroup`s on one subplot, each will be normalized within its own set.",
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::Scatter::Hoverlabel", );
135              
136             has hoveron => (
137             is => "rw",
138             isa => "Str",
139             documentation =>
140             "Do the hover effects highlight individual points (markers or line points) or do they highlight filled regions? If the fill is *toself* or *tonext* and there are no markers or text, then the default is *fills*, otherwise it is *points*.",
141             );
142              
143             has hovertemplate => (
144             is => "rw",
145             isa => "Str|ArrayRef[Str]",
146             documentation =>
147             "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>`.",
148             );
149              
150             has hovertemplatesrc => ( is => "rw",
151             isa => "Str",
152             documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
153             );
154              
155             has hovertext => (
156             is => "rw",
157             isa => "Str|ArrayRef[Str]",
158             documentation =>
159             "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.",
160             );
161              
162             has hovertextsrc => ( is => "rw",
163             isa => "Str",
164             documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
165             );
166              
167             has ids => (
168             is => "rw",
169             isa => "ArrayRef|PDL",
170             documentation =>
171             "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.",
172             );
173              
174             has idssrc => ( is => "rw",
175             isa => "Str",
176             documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
177             );
178              
179             has legendgroup => (
180             is => "rw",
181             isa => "Str",
182             documentation =>
183             "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
184             );
185              
186             has legendgrouptitle => ( is => "rw",
187             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Legendgrouptitle", );
188              
189             has legendrank => (
190             is => "rw",
191             isa => "Num",
192             documentation =>
193             "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.",
194             );
195              
196             has line => ( is => "rw",
197             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Line", );
198              
199             has marker => ( is => "rw",
200             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Marker", );
201              
202             has pmeta => (
203             is => "rw",
204             isa => "Any|ArrayRef[Any]",
205             documentation =>
206             "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.",
207             );
208              
209             has metasrc => ( is => "rw",
210             isa => "Str",
211             documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
212             );
213              
214             has mode => (
215             is => "rw",
216             isa => "Str",
217             documentation =>
218             "Determines the drawing mode for this scatter trace. If the provided `mode` includes *text* then the `text` elements appear at the coordinates. Otherwise, the `text` elements appear on hover. If there are less than 20 points and the trace is not stacked then the default is *lines+markers*. Otherwise, *lines*.",
219             );
220              
221             has name => ( is => "rw",
222             isa => "Str",
223             documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
224             );
225              
226             has opacity => ( is => "rw",
227             isa => "Num",
228             documentation => "Sets the opacity of the trace.",
229             );
230              
231             has orientation => (
232             is => "rw",
233             isa => enum( [ "v", "h" ] ),
234             documentation =>
235             "Only relevant when `stackgroup` is used, and only the first `orientation` found in the `stackgroup` will be used - including if `visible` is *legendonly* but not if it is `false`. Sets the stacking direction. With *v* (*h*), the y (x) values of subsequent traces are added. Also affects the default value of `fill`.",
236             );
237              
238             has selected => ( is => "rw",
239             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Selected", );
240              
241             has selectedpoints => (
242             is => "rw",
243             isa => "Any",
244             documentation =>
245             "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.",
246             );
247              
248             has showlegend => (
249             is => "rw",
250             isa => "Bool",
251             documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
252             );
253              
254             has stackgaps => (
255             is => "rw",
256             isa => enum( [ "infer zero", "interpolate" ] ),
257             documentation =>
258             "Only relevant when `stackgroup` is used, and only the first `stackgaps` found in the `stackgroup` will be used - including if `visible` is *legendonly* but not if it is `false`. Determines how we handle locations at which other traces in this group have data but this one does not. With *infer zero* we insert a zero at these locations. With *interpolate* we linearly interpolate between existing values, and extrapolate a constant beyond the existing values.",
259             );
260              
261             has stackgroup => (
262             is => "rw",
263             isa => "Str",
264             documentation =>
265             "Set several scatter traces (on the same subplot) to the same stackgroup in order to add their y values (or their x values if `orientation` is *h*). If blank or omitted this trace will not be stacked. Stacking also turns `fill` on by default, using *tonexty* (*tonextx*) if `orientation` is *h* (*v*) and sets the default `mode` to *lines* irrespective of point count. You can only stack on a numeric (linear or log) axis. 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.",
266             );
267              
268             has stream => ( is => "rw",
269             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Stream", );
270              
271             has text => (
272             is => "rw",
273             isa => "Str|ArrayRef[Str]",
274             documentation =>
275             "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.",
276             );
277              
278             has textfont => ( is => "rw",
279             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Textfont", );
280              
281             has textposition => (
282             is => "rw",
283             isa => union(
284             [
285             enum(
286             [ "top left",
287             "top center",
288             "top right",
289             "middle left",
290             "middle center",
291             "middle right",
292             "bottom left",
293             "bottom center",
294             "bottom right"
295             ]
296             ),
297             "ArrayRef"
298             ]
299             ),
300             documentation => "Sets the positions of the `text` elements with respects to the (x,y) coordinates.",
301             );
302              
303             has textpositionsrc => ( is => "rw",
304             isa => "Str",
305             documentation => "Sets the source reference on Chart Studio Cloud for `textposition`.",
306             );
307              
308             has textsrc => ( is => "rw",
309             isa => "Str",
310             documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
311             );
312              
313             has texttemplate => (
314             is => "rw",
315             isa => "Str|ArrayRef[Str]",
316             documentation =>
317             "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. ",
318             );
319              
320             has texttemplatesrc => ( is => "rw",
321             isa => "Str",
322             documentation => "Sets the source reference on Chart Studio Cloud for `texttemplate`.",
323             );
324              
325             has transforms => ( is => "rw",
326             isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Scatter::Transform]", );
327              
328             has uid => (
329             is => "rw",
330             isa => "Str",
331             documentation =>
332             "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
333             );
334              
335             has uirevision => (
336             is => "rw",
337             isa => "Any",
338             documentation =>
339             "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.",
340             );
341              
342             has unselected => ( is => "rw",
343             isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scatter::Unselected", );
344              
345             has visible => (
346             is => "rw",
347             documentation =>
348             "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).",
349             );
350              
351             has x => ( is => "rw",
352             isa => "ArrayRef|PDL",
353             documentation => "Sets the x coordinates.",
354             );
355              
356             has x0 => (
357             is => "rw",
358             isa => "Any",
359             documentation =>
360             "Alternate to `x`. Builds a linear space of x coordinates. Use with `dx` where `x0` is the starting coordinate and `dx` the step.",
361             );
362              
363             has xaxis => (
364             is => "rw",
365             documentation =>
366             "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.",
367             );
368              
369             has xcalendar => ( is => "rw",
370             isa => enum(
371             [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
372             "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
373             ]
374             ),
375             documentation => "Sets the calendar system to use with `x` date data.",
376             );
377              
378             has xhoverformat => (
379             is => "rw",
380             isa => "Str",
381             documentation =>
382             "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`.",
383             );
384              
385             has xperiod => (
386             is => "rw",
387             isa => "Any",
388             documentation =>
389             "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.",
390             );
391              
392             has xperiod0 => (
393             is => "rw",
394             isa => "Any",
395             documentation =>
396             "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.",
397             );
398              
399             has xperiodalignment => (
400             is => "rw",
401             isa => enum( [ "start", "middle", "end" ] ),
402             documentation => "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis.",
403             );
404              
405             has xsrc => ( is => "rw",
406             isa => "Str",
407             documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
408             );
409              
410             has y => ( is => "rw",
411             isa => "ArrayRef|PDL",
412             documentation => "Sets the y coordinates.",
413             );
414              
415             has y0 => (
416             is => "rw",
417             isa => "Any",
418             documentation =>
419             "Alternate to `y`. Builds a linear space of y coordinates. Use with `dy` where `y0` is the starting coordinate and `dy` the step.",
420             );
421              
422             has yaxis => (
423             is => "rw",
424             documentation =>
425             "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.",
426             );
427              
428             has ycalendar => ( is => "rw",
429             isa => enum(
430             [ "chinese", "coptic", "discworld", "ethiopian", "gregorian", "hebrew", "islamic", "jalali",
431             "julian", "mayan", "nanakshahi", "nepali", "persian", "taiwan", "thai", "ummalqura"
432             ]
433             ),
434             documentation => "Sets the calendar system to use with `y` date data.",
435             );
436              
437             has yhoverformat => (
438             is => "rw",
439             isa => "Str",
440             documentation =>
441             "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`.",
442             );
443              
444             has yperiod => (
445             is => "rw",
446             isa => "Any",
447             documentation =>
448             "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.",
449             );
450              
451             has yperiod0 => (
452             is => "rw",
453             isa => "Any",
454             documentation =>
455             "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.",
456             );
457              
458             has yperiodalignment => (
459             is => "rw",
460             isa => enum( [ "start", "middle", "end" ] ),
461             documentation => "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis.",
462             );
463              
464             has ysrc => ( is => "rw",
465             isa => "Str",
466             documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
467             );
468              
469             __PACKAGE__->meta->make_immutable();
470             1;
471              
472              
473             =pod
474              
475             =encoding utf-8
476              
477             =head1 NAME
478              
479             Chart::Plotly::Trace::Scatter - The scatter trace type encompasses line charts, scatter charts, text charts, and bubble charts. The data visualized as scatter point or lines is set in `x` and `y`. Text (appearing either on the chart or on hover only) is via `text`. Bubble charts are achieved by setting `marker.size` and/or `marker.color` to numerical arrays.
480              
481             =head1 VERSION
482              
483             version 0.042
484              
485             =head1 SYNOPSIS
486              
487             use HTML::Show;
488             use Chart::Plotly;
489             use Chart::Plotly::Trace::Scatter;
490             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
491            
492             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
493              
494             =head1 DESCRIPTION
495              
496             The scatter trace type encompasses line charts, scatter charts, text charts, and bubble charts. The data visualized as scatter point or lines is set in `x` and `y`. Text (appearing either on the chart or on hover only) is via `text`. Bubble charts are achieved by setting `marker.size` and/or `marker.color` to numerical arrays.
497              
498             Screenshot of the above example:
499              
500             =for HTML <p>
501             <img src="https://raw.githubusercontent.com/pablrod/p5-Chart-Plotly/master/examples/traces/scatter.png" alt="Screenshot of the above example">
502             </p>
503              
504             =for markdown ![Screenshot of the above example](https://raw.githubusercontent.com/pablrod/p5-Chart-Plotly/master/examples/traces/scatter.png)
505              
506             =for HTML <p>
507             <iframe src="https://raw.githubusercontent.com/pablrod/p5-Chart-Plotly/master/examples/traces/scatter.html" style="border:none;" width="80%" height="520"></iframe>
508             </p>
509              
510             This file has been autogenerated from the official plotly.js source.
511              
512             If you like Plotly, please support them: L<https://plot.ly/>
513             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
514              
515             Full reference: L<https://plot.ly/javascript/reference/#scatter>
516              
517             =head1 DISCLAIMER
518              
519             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
520             But I think plotly.js is a great library and I want to use it with perl.
521              
522             =head1 METHODS
523              
524             =head2 TO_JSON
525              
526             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
527              
528             =head2 type
529              
530             Trace type.
531              
532             =head1 ATTRIBUTES
533              
534             =over
535              
536             =item * cliponaxis
537              
538             Determines whether or not markers and text nodes are clipped about the subplot axes. To show markers and text nodes above axis lines and tick labels, make sure to set `xaxis.layer` and `yaxis.layer` to *below traces*.
539              
540             =item * connectgaps
541              
542             Determines whether or not gaps (i.e. {nan} or missing values) in the provided data arrays are connected.
543              
544             =item * customdata
545              
546             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
547              
548             =item * customdatasrc
549              
550             Sets the source reference on Chart Studio Cloud for `customdata`.
551              
552             =item * dx
553              
554             Sets the x coordinate step. See `x0` for more info.
555              
556             =item * dy
557              
558             Sets the y coordinate step. See `y0` for more info.
559              
560             =item * error_x
561              
562             =item * error_y
563              
564             =item * fill
565              
566             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.
567              
568             =item * fillcolor
569              
570             Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.
571              
572             =item * fillpattern
573              
574             =item * groupnorm
575              
576             Only relevant when `stackgroup` is used, and only the first `groupnorm` found in the `stackgroup` will be used - including if `visible` is *legendonly* but not if it is `false`. Sets the normalization for the sum of this `stackgroup`. With *fraction*, the value of each trace at each location is divided by the sum of all trace values at that location. *percent* is the same but multiplied by 100 to show percentages. If there are multiple subplots, or multiple `stackgroup`s on one subplot, each will be normalized within its own set.
577              
578             =item * hoverinfo
579              
580             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.
581              
582             =item * hoverinfosrc
583              
584             Sets the source reference on Chart Studio Cloud for `hoverinfo`.
585              
586             =item * hoverlabel
587              
588             =item * hoveron
589              
590             Do the hover effects highlight individual points (markers or line points) or do they highlight filled regions? If the fill is *toself* or *tonext* and there are no markers or text, then the default is *fills*, otherwise it is *points*.
591              
592             =item * hovertemplate
593              
594             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>`.
595              
596             =item * hovertemplatesrc
597              
598             Sets the source reference on Chart Studio Cloud for `hovertemplate`.
599              
600             =item * hovertext
601              
602             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.
603              
604             =item * hovertextsrc
605              
606             Sets the source reference on Chart Studio Cloud for `hovertext`.
607              
608             =item * ids
609              
610             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.
611              
612             =item * idssrc
613              
614             Sets the source reference on Chart Studio Cloud for `ids`.
615              
616             =item * legendgroup
617              
618             Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.
619              
620             =item * legendgrouptitle
621              
622             =item * legendrank
623              
624             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.
625              
626             =item * line
627              
628             =item * marker
629              
630             =item * pmeta
631              
632             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.
633              
634             =item * metasrc
635              
636             Sets the source reference on Chart Studio Cloud for `meta`.
637              
638             =item * mode
639              
640             Determines the drawing mode for this scatter trace. If the provided `mode` includes *text* then the `text` elements appear at the coordinates. Otherwise, the `text` elements appear on hover. If there are less than 20 points and the trace is not stacked then the default is *lines+markers*. Otherwise, *lines*.
641              
642             =item * name
643              
644             Sets the trace name. The trace name appear as the legend item and on hover.
645              
646             =item * opacity
647              
648             Sets the opacity of the trace.
649              
650             =item * orientation
651              
652             Only relevant when `stackgroup` is used, and only the first `orientation` found in the `stackgroup` will be used - including if `visible` is *legendonly* but not if it is `false`. Sets the stacking direction. With *v* (*h*), the y (x) values of subsequent traces are added. Also affects the default value of `fill`.
653              
654             =item * selected
655              
656             =item * selectedpoints
657              
658             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.
659              
660             =item * showlegend
661              
662             Determines whether or not an item corresponding to this trace is shown in the legend.
663              
664             =item * stackgaps
665              
666             Only relevant when `stackgroup` is used, and only the first `stackgaps` found in the `stackgroup` will be used - including if `visible` is *legendonly* but not if it is `false`. Determines how we handle locations at which other traces in this group have data but this one does not. With *infer zero* we insert a zero at these locations. With *interpolate* we linearly interpolate between existing values, and extrapolate a constant beyond the existing values.
667              
668             =item * stackgroup
669              
670             Set several scatter traces (on the same subplot) to the same stackgroup in order to add their y values (or their x values if `orientation` is *h*). If blank or omitted this trace will not be stacked. Stacking also turns `fill` on by default, using *tonexty* (*tonextx*) if `orientation` is *h* (*v*) and sets the default `mode` to *lines* irrespective of point count. You can only stack on a numeric (linear or log) axis. 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.
671              
672             =item * stream
673              
674             =item * text
675              
676             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.
677              
678             =item * textfont
679              
680             =item * textposition
681              
682             Sets the positions of the `text` elements with respects to the (x,y) coordinates.
683              
684             =item * textpositionsrc
685              
686             Sets the source reference on Chart Studio Cloud for `textposition`.
687              
688             =item * textsrc
689              
690             Sets the source reference on Chart Studio Cloud for `text`.
691              
692             =item * texttemplate
693              
694             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.
695              
696             =item * texttemplatesrc
697              
698             Sets the source reference on Chart Studio Cloud for `texttemplate`.
699              
700             =item * transforms
701              
702             =item * uid
703              
704             Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.
705              
706             =item * uirevision
707              
708             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.
709              
710             =item * unselected
711              
712             =item * visible
713              
714             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).
715              
716             =item * x
717              
718             Sets the x coordinates.
719              
720             =item * x0
721              
722             Alternate to `x`. Builds a linear space of x coordinates. Use with `dx` where `x0` is the starting coordinate and `dx` the step.
723              
724             =item * xaxis
725              
726             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.
727              
728             =item * xcalendar
729              
730             Sets the calendar system to use with `x` date data.
731              
732             =item * xhoverformat
733              
734             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`.
735              
736             =item * xperiod
737              
738             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.
739              
740             =item * xperiod0
741              
742             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.
743              
744             =item * xperiodalignment
745              
746             Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis.
747              
748             =item * xsrc
749              
750             Sets the source reference on Chart Studio Cloud for `x`.
751              
752             =item * y
753              
754             Sets the y coordinates.
755              
756             =item * y0
757              
758             Alternate to `y`. Builds a linear space of y coordinates. Use with `dy` where `y0` is the starting coordinate and `dy` the step.
759              
760             =item * yaxis
761              
762             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.
763              
764             =item * ycalendar
765              
766             Sets the calendar system to use with `y` date data.
767              
768             =item * yhoverformat
769              
770             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`.
771              
772             =item * yperiod
773              
774             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.
775              
776             =item * yperiod0
777              
778             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.
779              
780             =item * yperiodalignment
781              
782             Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis.
783              
784             =item * ysrc
785              
786             Sets the source reference on Chart Studio Cloud for `y`.
787              
788             =back
789              
790             =head1 AUTHOR
791              
792             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
793              
794             =head1 COPYRIGHT AND LICENSE
795              
796             This software is Copyright (c) 2022 by Pablo Rodríguez González.
797              
798             This is free software, licensed under:
799              
800             The MIT (X11) License
801              
802             =cut