Chart/Plotly/Trace/Barpolar.pm untested

filter: Statementstmt 0.0% 0 / 104 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 / 143 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::Barpolar;
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::Barpolar::Hoverlabel;
10 use Chart::Plotly::Trace::Barpolar::Legendgrouptitle;
11 use Chart::Plotly::Trace::Barpolar::Marker;
12 use Chart::Plotly::Trace::Barpolar::Selected;
13 use Chart::Plotly::Trace::Barpolar::Stream;
14 use Chart::Plotly::Trace::Barpolar::Transform;
15 use Chart::Plotly::Trace::Barpolar::Unselected;
16  
17 our $VERSION = '0.042'; # VERSION
18  
19 # ABSTRACT: The data visualized by the radial span of the bars is set in `r`
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 base => (
54 is => "rw",
55 isa => "Any|ArrayRef[Any]",
56 documentation =>
57 "Sets where the bar base is drawn (in radial axis units). In *stack* barmode, traces that set *base* will be excluded and drawn in *overlay* mode instead.",
58 );
59  
60 has basesrc => ( is => "rw",
61 isa => "Str",
62 documentation => "Sets the source reference on Chart Studio Cloud for `base`.",
63 );
64  
65 has customdata => (
66 is => "rw",
67 isa => "ArrayRef|PDL",
68 documentation =>
69 "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",
70 );
71  
72 has customdatasrc => ( is => "rw",
73 isa => "Str",
74 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
75 );
76  
77 has dr => ( is => "rw",
78 isa => "Num",
79 documentation => "Sets the r coordinate step.",
80 );
81  
82 has dtheta => (
83 is => "rw",
84 isa => "Num",
85 documentation =>
86 "Sets the theta coordinate step. By default, the `dtheta` step equals the subplot's period divided by the length of the `r` coordinates.",
87 );
88  
89 has hoverinfo => (
90 is => "rw",
91 isa => "Str|ArrayRef[Str]",
92 documentation =>
93 "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.",
94 );
95  
96 has hoverinfosrc => ( is => "rw",
97 isa => "Str",
98 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
99 );
100  
101 has hoverlabel => ( is => "rw",
102 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Barpolar::Hoverlabel", );
103  
104 has hovertemplate => (
105 is => "rw",
106 isa => "Str|ArrayRef[Str]",
107 documentation =>
108 "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>`.",
109 );
110  
111 has hovertemplatesrc => ( is => "rw",
112 isa => "Str",
113 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
114 );
115  
116 has hovertext => ( is => "rw",
117 isa => "Str|ArrayRef[Str]",
118 documentation => "Same as `text`.",
119 );
120  
121 has hovertextsrc => ( is => "rw",
122 isa => "Str",
123 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
124 );
125  
126 has ids => (
127 is => "rw",
128 isa => "ArrayRef|PDL",
129 documentation =>
130 "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.",
131 );
132  
133 has idssrc => ( is => "rw",
134 isa => "Str",
135 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
136 );
137  
138 has legendgroup => (
139 is => "rw",
140 isa => "Str",
141 documentation =>
142 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
143 );
144  
145 has legendgrouptitle => ( is => "rw",
146 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Barpolar::Legendgrouptitle", );
147  
148 has legendrank => (
149 is => "rw",
150 isa => "Num",
151 documentation =>
152 "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.",
153 );
154  
155 has marker => ( is => "rw",
156 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Barpolar::Marker", );
157  
158 has pmeta => (
159 is => "rw",
160 isa => "Any|ArrayRef[Any]",
161 documentation =>
162 "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.",
163 );
164  
165 has metasrc => ( is => "rw",
166 isa => "Str",
167 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
168 );
169  
170 has name => ( is => "rw",
171 isa => "Str",
172 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
173 );
174  
175 has offset => ( is => "rw",
176 isa => "Num|ArrayRef[Num]",
177 documentation => "Shifts the angular position where the bar is drawn (in *thetatunit* units).",
178 );
179  
180 has offsetsrc => ( is => "rw",
181 isa => "Str",
182 documentation => "Sets the source reference on Chart Studio Cloud for `offset`.",
183 );
184  
185 has opacity => ( is => "rw",
186 isa => "Num",
187 documentation => "Sets the opacity of the trace.",
188 );
189  
190 has r => ( is => "rw",
191 isa => "ArrayRef|PDL",
192 documentation => "Sets the radial coordinates",
193 );
194  
195 has r0 => (
196 is => "rw",
197 isa => "Any",
198 documentation =>
199 "Alternate to `r`. Builds a linear space of r coordinates. Use with `dr` where `r0` is the starting coordinate and `dr` the step.",
200 );
201  
202 has rsrc => ( is => "rw",
203 isa => "Str",
204 documentation => "Sets the source reference on Chart Studio Cloud for `r`.",
205 );
206  
207 has selected => ( is => "rw",
208 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Barpolar::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::Barpolar::Stream", );
225  
226 has subplot => (
227 is => "rw",
228 documentation =>
229 "Sets a reference between this trace's data coordinates and a polar subplot. If *polar* (the default value), the data refer to `layout.polar`. If *polar2*, the data refer to `layout.polar2`, and so on.",
230 );
231  
232 has text => (
233 is => "rw",
234 isa => "Str|ArrayRef[Str]",
235 documentation =>
236 "Sets hover text elements associated with each bar. If a single string, the same string appears over all bars. If an array of string, the items are mapped in order to the this trace's coordinates.",
237 );
238  
239 has textsrc => ( is => "rw",
240 isa => "Str",
241 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
242 );
243  
244 has theta => ( is => "rw",
245 isa => "ArrayRef|PDL",
246 documentation => "Sets the angular coordinates",
247 );
248  
249 has theta0 => (
250 is => "rw",
251 isa => "Any",
252 documentation =>
253 "Alternate to `theta`. Builds a linear space of theta coordinates. Use with `dtheta` where `theta0` is the starting coordinate and `dtheta` the step.",
254 );
255  
256 has thetasrc => ( is => "rw",
257 isa => "Str",
258 documentation => "Sets the source reference on Chart Studio Cloud for `theta`.",
259 );
260  
261 has thetaunit => (
262 is => "rw",
263 isa => enum( [ "radians", "degrees", "gradians" ] ),
264 documentation => "Sets the unit of input *theta* values. Has an effect only when on *linear* angular axes.",
265 );
266  
267 has transforms => ( is => "rw",
268 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Barpolar::Transform]", );
269  
270 has uid => (
271 is => "rw",
272 isa => "Str",
273 documentation =>
274 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
275 );
276  
277 has uirevision => (
278 is => "rw",
279 isa => "Any",
280 documentation =>
281 "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.",
282 );
283  
284 has unselected => ( is => "rw",
285 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Barpolar::Unselected", );
286  
287 has visible => (
288 is => "rw",
289 documentation =>
290 "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).",
291 );
292  
293 has width => ( is => "rw",
294 isa => "Num|ArrayRef[Num]",
295 documentation => "Sets the bar angular width (in *thetaunit* units).",
296 );
297  
298 has widthsrc => ( is => "rw",
299 isa => "Str",
300 documentation => "Sets the source reference on Chart Studio Cloud for `width`.",
301 );
302  
303 __PACKAGE__->meta->make_immutable();
304 1;
305  
306 __END__