Chart/Plotly/Trace/Funnel.pm

filter: Statementstmt 98.4% 124 / 126 Branchbran 50.0% 6 / 12 Conditioncond 37.5% 3 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 100% 14 / 14 Podpod 100% 2 / 2 totaltotal 89.2% 149 / 167 CC 10 SCAR 18.0
CC
10
Cov
91%
TO_JSON
12.6
BEGIN
1.0
BEGIN
1.0
CRAP 6.1
« Chart/Plotly.pm ↑ Summary Chart/Plotly/Trace/Scatter.pm »
1 package Chart::Plotly::Trace::Funnel;
2 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use MooseX::ExtraArgs;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 1 ▶use Moose::Util::TypeConstraints qw(enum union);
Subroutine BEGIN: called CC=1 SCAR=0.0
5 1 ▶if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
Branch: 1 branch
BranchTrueFalseTotal
unless (defined Moose::Util::TypeConstraints::find_type_constraint("PDL")) 0 1 1
6 0 Moose::Util::TypeConstraints::type('PDL');
7 }
8  
9 1 ▶use Chart::Plotly::Trace::Funnel::Connector;
Subroutine BEGIN: called CC=1 SCAR=0.0
10 1 ▶use Chart::Plotly::Trace::Funnel::Hoverlabel;
Subroutine BEGIN: called CC=1 SCAR=0.0
11 1 ▶use Chart::Plotly::Trace::Funnel::Insidetextfont;
Subroutine BEGIN: called CC=1 SCAR=0.0
12 1 ▶use Chart::Plotly::Trace::Funnel::Legendgrouptitle;
Subroutine BEGIN: called CC=1 SCAR=0.0
13 1 ▶use Chart::Plotly::Trace::Funnel::Marker;
Subroutine BEGIN: called CC=1 SCAR=0.0
14 1 ▶use Chart::Plotly::Trace::Funnel::Outsidetextfont;
Subroutine BEGIN: called CC=1 SCAR=0.0
15 1 ▶use Chart::Plotly::Trace::Funnel::Stream;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use Chart::Plotly::Trace::Funnel::Textfont;
Subroutine BEGIN: called CC=1 SCAR=0.0
17 1 ▶use Chart::Plotly::Trace::Funnel::Transform;
Subroutine BEGIN: called CC=1 SCAR=0.0
18  
19 1 our $VERSION = '0.042'; # VERSION
20  
21 # ABSTRACT: Visualize stages in a process using length-encoded bars. This trace can be used to show data in either a part-to-whole representation wherein each item appears in a single stage, or in a "drop-off" representation wherein each item appears in each stage it traversed. See also the "funnelarea" trace type for a different approach to visualizing funnel data.
22  
23 1 ▶sub TO_JSON {
Subroutine TO_JSON: called CC=10 SCAR=25.4
Pod documented
24 1 my $self = shift;
25 1 ▶ my $extra_args = $self->extra_args // {};
Condition50%1/2
$self->extra_args // {}
l!l
10
MC/DC0%0/1
$self->extra_args // {}
$self->extra_args
Truth table50%1/2
A
A= $self->extra_args
Aresult
11
00
26 1 my $meta = $self->meta;
27 1 my %hash = %$self;
28 1 for my $name ( sort keys %hash ) {
29 4 my $attr = $meta->get_attribute($name);
30 4 ▶ if ( defined $attr ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $attr) 3 1 4
31 3 my $value = $hash{$name};
32 3 my $type = $attr->type_constraint;
33 3 ▶ if ( $type && $type->equals('Bool') ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($type and $type->equals("Bool")) 0 3 3
Condition33%1/3
$type and $type->equals("Bool")
!ll&&!rl&&r
030
MC/DC0%0/2
$type and $type->equals("Bool")
$type $type->equals("Bool")
Truth table33%1/3
A and B
A= $typeB= $type->equals("Bool")
ABresult
0X0
100
111
34 0 ▶ $hash{$name} = $value ? \1 : \0;
Branch: 1 branch
BranchTrueFalseTotal
$value ? : 0 0 0
35 }
36 }
37 }
38 1 my $plotly_meta = delete $hash{'pmeta'};
39 1 ▶ if ( defined $plotly_meta ) {
Branch: 1 branch
BranchTrueFalseTotal
if (defined $plotly_meta) 1 0 1
40 1 $hash{'meta'} = $plotly_meta;
41 }
42 1 %hash = ( %hash, %$extra_args );
43 1 delete $hash{'extra_args'};
44 1 ▶ if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
Branch: 1 branch
BranchTrueFalseTotal
if ($self->can("type") and not defined $hash{"type"}) 1 0 1
Condition33%1/3
$self->can("type") and not defined $hash{"type"}
!ll&&!rl&&r
001
MC/DC0%0/2
$self->can("type") and not defined $hash{"type"}
$self->can("type") not defined $hash{"type"}
Truth table33%1/3
A and not(B)
A= $self->can("type")B= not defined $hash{"type"}
ABresult
0X0
100
111
45 1 $hash{type} = $self->type();
46 }
47 1 return \%hash;
48 }
49  
50 1 ▶sub type {
Subroutine type: called CC=1 SCAR=0.0
Pod documented
51 1 my @components = split( /::/, __PACKAGE__ );
52 1 return lc( $components[-1] );
53 }
54  
55 1 has alignmentgroup => (
56 is => "rw",
57 isa => "Str",
58 documentation =>
59 "Set several traces linked to the same position axis or matching axes to the same alignmentgroup. This controls whether bars compute their positional range dependently or independently.",
60 );
61  
62 1 has cliponaxis => (
63 is => "rw",
64 isa => "Bool",
65 documentation =>
66 "Determines whether the text nodes are clipped about the subplot axes. To show the text nodes above axis lines and tick labels, make sure to set `xaxis.layer` and `yaxis.layer` to *below traces*.",
67 );
68  
69 1 has connector => ( is => "rw",
70 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Funnel::Connector", );
71  
72 1 has constraintext => (
73 is => "rw",
74 isa => enum( [ "inside", "outside", "both", "none" ] ),
75 documentation => "Constrain the size of text inside or outside a bar to be no larger than the bar itself.",
76 );
77  
78 1 has customdata => (
79 is => "rw",
80 isa => "ArrayRef|PDL",
81 documentation =>
82 "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",
83 );
84  
85 1 has customdatasrc => ( is => "rw",
86 isa => "Str",
87 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
88 );
89  
90 1 has dx => ( is => "rw",
91 isa => "Num",
92 documentation => "Sets the x coordinate step. See `x0` for more info.",
93 );
94  
95 1 has dy => ( is => "rw",
96 isa => "Num",
97 documentation => "Sets the y coordinate step. See `y0` for more info.",
98 );
99  
100 1 has hoverinfo => (
101 is => "rw",
102 isa => "Str|ArrayRef[Str]",
103 documentation =>
104 "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.",
105 );
106  
107 1 has hoverinfosrc => ( is => "rw",
108 isa => "Str",
109 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
110 );
111  
112 1 has hoverlabel => ( is => "rw",
113 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Funnel::Hoverlabel", );
114  
115 1 has hovertemplate => (
116 is => "rw",
117 isa => "Str|ArrayRef[Str]",
118 documentation =>
119 "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. variables `percentInitial`, `percentPrevious` and `percentTotal`. 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>`.",
120 );
121  
122 1 has hovertemplatesrc => ( is => "rw",
123 isa => "Str",
124 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
125 );
126  
127 1 has hovertext => (
128 is => "rw",
129 isa => "Str|ArrayRef[Str]",
130 documentation =>
131 "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.",
132 );
133  
134 1 has hovertextsrc => ( is => "rw",
135 isa => "Str",
136 documentation => "Sets the source reference on Chart Studio Cloud for `hovertext`.",
137 );
138  
139 1 has ids => (
140 is => "rw",
141 isa => "ArrayRef|PDL",
142 documentation =>
143 "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.",
144 );
145  
146 1 has idssrc => ( is => "rw",
147 isa => "Str",
148 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
149 );
150  
151 1 has insidetextanchor => (
152 is => "rw",
153 isa => enum( [ "end", "middle", "start" ] ),
154 documentation => "Determines if texts are kept at center or start/end points in `textposition` *inside* mode.",
155 );
156  
157 1 has insidetextfont => ( is => "rw",
158 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Funnel::Insidetextfont", );
159  
160 1 has legendgroup => (
161 is => "rw",
162 isa => "Str",
163 documentation =>
164 "Sets the legend group for this trace. Traces part of the same legend group hide/show at the same time when toggling legend items.",
165 );
166  
167 1 has legendgrouptitle => ( is => "rw",
168 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Funnel::Legendgrouptitle", );
169  
170 1 has legendrank => (
171 is => "rw",
172 isa => "Num",
173 documentation =>
174 "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.",
175 );
176  
177 1 has marker => ( is => "rw",
178 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Funnel::Marker", );
179  
180 1 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 1 has metasrc => ( is => "rw",
188 isa => "Str",
189 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
190 );
191  
192 1 has name => ( is => "rw",
193 isa => "Str",
194 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
195 );
196  
197 1 has offset => (
198 is => "rw",
199 isa => "Num",
200 documentation =>
201 "Shifts the position where the bar is drawn (in position axis units). In *group* barmode, traces that set *offset* will be excluded and drawn in *overlay* mode instead.",
202 );
203  
204 1 has offsetgroup => (
205 is => "rw",
206 isa => "Str",
207 documentation =>
208 "Set several traces linked to the same position axis or matching axes to the same offsetgroup where bars of the same position coordinate will line up.",
209 );
210  
211 1 has opacity => ( is => "rw",
212 isa => "Num",
213 documentation => "Sets the opacity of the trace.",
214 );
215  
216 1 has orientation => (
217 is => "rw",
218 isa => enum( [ "v", "h" ] ),
219 documentation =>
220 "Sets the orientation of the funnels. With *v* (*h*), the value of the each bar spans along the vertical (horizontal). By default funnels are tend to be oriented horizontally; unless only *y* array is presented or orientation is set to *v*. Also regarding graphs including only 'horizontal' funnels, *autorange* on the *y-axis* are set to *reversed*.",
221 );
222  
223 1 has outsidetextfont => ( is => "rw",
224 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Funnel::Outsidetextfont", );
225  
226 1 has selectedpoints => (
227 is => "rw",
228 isa => "Any",
229 documentation =>
230 "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.",
231 );
232  
233 1 has showlegend => (
234 is => "rw",
235 isa => "Bool",
236 documentation => "Determines whether or not an item corresponding to this trace is shown in the legend.",
237 );
238  
239 1 has stream => ( is => "rw",
240 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Funnel::Stream", );
241  
242 1 has text => (
243 is => "rw",
244 isa => "Str|ArrayRef[Str]",
245 documentation =>
246 "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.",
247 );
248  
249 1 has textangle => (
250 is => "rw",
251 documentation =>
252 "Sets the angle of the tick labels with respect to the bar. For example, a `tickangle` of -90 draws the tick labels vertically. With *auto* the texts may automatically be rotated to fit with the maximum size in bars.",
253 );
254  
255 1 has textfont => ( is => "rw",
256 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Funnel::Textfont", );
257  
258 1 has textinfo => (
259 is => "rw",
260 isa => "Str",
261 documentation =>
262 "Determines which trace information appear on the graph. In the case of having multiple funnels, percentages & totals are computed separately (per trace).",
263 );
264  
265 1 has textposition => (
266 is => "rw",
267 isa => union( [ enum( [ "inside", "outside", "auto", "none" ] ), "ArrayRef" ] ),
268 documentation =>
269 "Specifies the location of the `text`. *inside* positions `text` inside, next to the bar end (rotated and scaled if needed). *outside* positions `text` outside, next to the bar end (scaled if needed), unless there is another bar stacked on this one, then the text gets pushed inside. *auto* tries to position `text` inside the bar, but if the bar is too small and no bar is stacked on this one the text is moved outside. If *none*, no text appears.",
270 );
271  
272 1 has textpositionsrc => ( is => "rw",
273 isa => "Str",
274 documentation => "Sets the source reference on Chart Studio Cloud for `textposition`.",
275 );
276  
277 1 has textsrc => ( is => "rw",
278 isa => "Str",
279 documentation => "Sets the source reference on Chart Studio Cloud for `text`.",
280 );
281  
282 1 has texttemplate => (
283 is => "rw",
284 isa => "Str|ArrayRef[Str]",
285 documentation =>
286 "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 `percentInitial`, `percentPrevious`, `percentTotal`, `label` and `value`.",
287 );
288  
289 1 has texttemplatesrc => ( is => "rw",
290 isa => "Str",
291 documentation => "Sets the source reference on Chart Studio Cloud for `texttemplate`.",
292 );
293  
294 1 has transforms => ( is => "rw",
295 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Funnel::Transform]", );
296  
297 1 has uid => (
298 is => "rw",
299 isa => "Str",
300 documentation =>
301 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
302 );
303  
304 1 has uirevision => (
305 is => "rw",
306 isa => "Any",
307 documentation =>
308 "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.",
309 );
310  
311 1 has visible => (
312 is => "rw",
313 documentation =>
314 "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).",
315 );
316  
317 1 has width => ( is => "rw",
318 isa => "Num",
319 documentation => "Sets the bar width (in position axis units).",
320 );
321  
322 1 has x => ( is => "rw",
323 isa => "ArrayRef|PDL",
324 documentation => "Sets the x coordinates.",
325 );
326  
327 1 has x0 => (
328 is => "rw",
329 isa => "Any",
330 documentation =>
331 "Alternate to `x`. Builds a linear space of x coordinates. Use with `dx` where `x0` is the starting coordinate and `dx` the step.",
332 );
333  
334 1 has xaxis => (
335 is => "rw",
336 documentation =>
337 "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.",
338 );
339  
340 1 has xhoverformat => (
341 is => "rw",
342 isa => "Str",
343 documentation =>
344 "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`.",
345 );
346  
347 1 has xperiod => (
348 is => "rw",
349 isa => "Any",
350 documentation =>
351 "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.",
352 );
353  
354 1 has xperiod0 => (
355 is => "rw",
356 isa => "Any",
357 documentation =>
358 "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.",
359 );
360  
361 1 has xperiodalignment => (
362 is => "rw",
363 isa => enum( [ "start", "middle", "end" ] ),
364 documentation => "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the x axis.",
365 );
366  
367 1 has xsrc => ( is => "rw",
368 isa => "Str",
369 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
370 );
371  
372 1 has y => ( is => "rw",
373 isa => "ArrayRef|PDL",
374 documentation => "Sets the y coordinates.",
375 );
376  
377 1 has y0 => (
378 is => "rw",
379 isa => "Any",
380 documentation =>
381 "Alternate to `y`. Builds a linear space of y coordinates. Use with `dy` where `y0` is the starting coordinate and `dy` the step.",
382 );
383  
384 1 has yaxis => (
385 is => "rw",
386 documentation =>
387 "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.",
388 );
389  
390 1 has yhoverformat => (
391 is => "rw",
392 isa => "Str",
393 documentation =>
394 "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`.",
395 );
396  
397 1 has yperiod => (
398 is => "rw",
399 isa => "Any",
400 documentation =>
401 "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.",
402 );
403  
404 1 has yperiod0 => (
405 is => "rw",
406 isa => "Any",
407 documentation =>
408 "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.",
409 );
410  
411 1 has yperiodalignment => (
412 is => "rw",
413 isa => enum( [ "start", "middle", "end" ] ),
414 documentation => "Only relevant when the axis `type` is *date*. Sets the alignment of data points on the y axis.",
415 );
416  
417 1 has ysrc => ( is => "rw",
418 isa => "Str",
419 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
420 );
421  
422 1 __PACKAGE__->meta->make_immutable();
423 1 1;
424  
425 __END__
« Chart/Plotly.pm ↑ Summary Chart/Plotly/Trace/Scatter.pm »