Chart/Plotly/Trace/Scattersmith.pm untested

filter: Statementstmt 0.0% 0 / 115 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 14 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 156 CC 6 SCAR 26.8
CC
6
Cov
0%
TO_JSON
42.0
type
2.0
BEGIN
2.0
CRAP 14.6
1 package Chart::Plotly::Trace::Scattersmith;
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::Scattersmith::Hoverlabel;
10 use Chart::Plotly::Trace::Scattersmith::Legendgrouptitle;
11 use Chart::Plotly::Trace::Scattersmith::Line;
12 use Chart::Plotly::Trace::Scattersmith::Marker;
13 use Chart::Plotly::Trace::Scattersmith::Selected;
14 use Chart::Plotly::Trace::Scattersmith::Stream;
15 use Chart::Plotly::Trace::Scattersmith::Textfont;
16 use Chart::Plotly::Trace::Scattersmith::Transform;
17 use Chart::Plotly::Trace::Scattersmith::Unselected;
18  
19 our $VERSION = '0.042'; # VERSION
20  
21 # ABSTRACT: The scattersmith trace type encompasses line charts, scatter charts, text charts, and bubble charts in smith coordinates. The data visualized as scatter point or lines is set in `real` and `imag` (imaginary) coordinates 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.
22  
23 sub TO_JSON {
24 my $self = shift;
25 my $extra_args = $self->extra_args // {};
26 my $meta = $self->meta;
27 my %hash = %$self;
28 for my $name ( sort keys %hash ) {
29 my $attr = $meta->get_attribute($name);
30 if ( defined $attr ) {
31 my $value = $hash{$name};
32 my $type = $attr->type_constraint;
33 if ( $type && $type->equals('Bool') ) {
34 $hash{$name} = $value ? \1 : \0;
35 }
36 }
37 }
38 my $plotly_meta = delete $hash{'pmeta'};
39 if ( defined $plotly_meta ) {
40 $hash{'meta'} = $plotly_meta;
41 }
42 %hash = ( %hash, %$extra_args );
43 delete $hash{'extra_args'};
44 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
45 $hash{type} = $self->type();
46 }
47 return \%hash;
48 }
49  
50 sub type {
51 my @components = split( /::/, __PACKAGE__ );
52 return lc( $components[-1] );
53 }
54  
55 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 fill => (
82 is => "rw",
83 isa => enum( [ "none", "toself", "tonext" ] ),
84 documentation =>
85 "Sets the area to fill with a solid color. Use with `fillcolor` if not *none*. scattersmith has a subset of the options available to scatter. *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.",
86 );
87  
88 has fillcolor => (
89 is => "rw",
90 isa => "Str",
91 documentation =>
92 "Sets the fill color. Defaults to a half-transparent variant of the line color, marker color, or marker line color, whichever is available.",
93 );
94  
95 has hoverinfo => (
96 is => "rw",
97 isa => "Str|ArrayRef[Str]",
98 documentation =>
99 "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.",
100 );
101  
102 has hoverinfosrc => ( is => "rw",
103 isa => "Str",
104 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
105 );
106  
107 has hoverlabel => ( is => "rw",
108 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattersmith::Hoverlabel", );
109  
110 has hoveron => (
111 is => "rw",
112 isa => "Str",
113 documentation =>
114 "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*.",
115 );
116  
117 has hovertemplate => (
118 is => "rw",
119 isa => "Str|ArrayRef[Str]",
120 documentation =>
121 "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>`.",
122 );
123  
124 has hovertemplatesrc => ( is => "rw",
125 isa => "Str",
126 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
127 );
128  
129 has hovertext => (
130 is => "rw",
131 isa => "Str|ArrayRef[Str]",
132 documentation =>
133 "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.",
134 );
135  
136 has hovertextsrc => ( is => "rw",
137 isa => "Str",
138 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
139 );
140  
141 has ids => (
142 is => "rw",
143 isa => "ArrayRef|PDL",
144 documentation =>
145 "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.",
146 );
147  
148 has idssrc => ( is => "rw",
149 isa => "Str",
150 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
151 );
152  
153 has imag => (
154 is => "rw",
155 isa => "ArrayRef|PDL",
156 documentation =>
157 "Sets the imaginary component of the data, in units of normalized impedance such that real=1, imag=0 is the center of the chart.",
158 );
159  
160 has imagsrc => ( is => "rw",
161 isa => "Str",
162 documentation => "Sets the source reference on Chart Studio Cloud for `imag`.",
163 );
164  
165 has legendgroup => (
166 is => "rw",
167 isa => "Str",
168 documentation =>
169 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
170 );
171  
172 has legendgrouptitle => ( is => "rw",
173 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattersmith::Legendgrouptitle", );
174  
175 has legendrank => (
176 is => "rw",
177 isa => "Num",
178 documentation =>
179 "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.",
180 );
181  
182 has line => ( is => "rw",
183 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattersmith::Line", );
184  
185 has marker => ( is => "rw",
186 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattersmith::Marker", );
187  
188 has pmeta => (
189 is => "rw",
190 isa => "Any|ArrayRef[Any]",
191 documentation =>
192 "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.",
193 );
194  
195 has metasrc => ( is => "rw",
196 isa => "Str",
197 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
198 );
199  
200 has mode => (
201 is => "rw",
202 isa => "Str",
203 documentation =>
204 "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*.",
205 );
206  
207 has name => ( is => "rw",
208 isa => "Str",
209 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
210 );
211  
212 has opacity => ( is => "rw",
213 isa => "Num",
214 documentation => "Sets the opacity of the trace.",
215 );
216  
217 has real => (
218 is => "rw",
219 isa => "ArrayRef|PDL",
220 documentation =>
221 "Sets the real component of the data, in units of normalized impedance such that real=1, imag=0 is the center of the chart.",
222 );
223  
224 has realsrc => ( is => "rw",
225 isa => "Str",
226 documentation => "Sets the source reference on Chart Studio Cloud for `real`.",
227 );
228  
229 has selected => ( is => "rw",
230 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattersmith::Selected", );
231  
232 has selectedpoints => (
233 is => "rw",
234 isa => "Any",
235 documentation =>
236 "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.",
237 );
238  
239 has showlegend => (
240 is => "rw",
241 isa => "Bool",
242 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
243 );
244  
245 has stream => ( is => "rw",
246 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattersmith::Stream", );
247  
248 has subplot => (
249 is => "rw",
250 documentation =>
251 "Sets a reference between this trace's data coordinates and a smith subplot. If *smith* (the default value), the data refer to `layout.smith`. If *smith2*, the data refer to `layout.smith2`, and so on.",
252 );
253  
254 has text => (
255 is => "rw",
256 isa => "Str|ArrayRef[Str]",
257 documentation =>
258 "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.",
259 );
260  
261 has textfont => ( is => "rw",
262 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattersmith::Textfont", );
263  
264 has textposition => (
265 is => "rw",
266 isa => union(
267 [
268 enum(
269 [ "top left",
270 "top center",
271 "top right",
272 "middle left",
273 "middle center",
274 "middle right",
275 "bottom left",
276 "bottom center",
277 "bottom right"
278 ]
279 ),
280 "ArrayRef"
281 ]
282 ),
283 documentation => "Sets the positions of the `text` elements with respects to the (x,y) coordinates.",
284 );
285  
286 has textpositionsrc => ( is => "rw",
287 isa => "Str",
288 documentation => "Sets the source reference on Chart Studio Cloud for `textposition`.",
289 );
290  
291 has textsrc => ( is => "rw",
292 isa => "Str",
293 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
294 );
295  
296 has texttemplate => (
297 is => "rw",
298 isa => "Str|ArrayRef[Str]",
299 documentation =>
300 "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. variables `real`, `imag` and `text`.",
301 );
302  
303 has texttemplatesrc => ( is => "rw",
304 isa => "Str",
305 documentation => "Sets the source reference on Chart Studio Cloud for `texttemplate`.",
306 );
307  
308 has transforms => ( is => "rw",
309 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Scattersmith::Transform]", );
310  
311 has uid => (
312 is => "rw",
313 isa => "Str",
314 documentation =>
315 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
316 );
317  
318 has uirevision => (
319 is => "rw",
320 isa => "Any",
321 documentation =>
322 "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.",
323 );
324  
325 has unselected => ( is => "rw",
326 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Scattersmith::Unselected", );
327  
328 has visible => (
329 is => "rw",
330 documentation =>
331 "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).",
332 );
333  
334 __PACKAGE__->meta->make_immutable();
335 1;
336  
337 __END__