Chart/Plotly/Trace/Parcats.pm untested

filter: Statementstmt 0.0% 0 / 87 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 13 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 127 CC 6 SCAR 27.3
CC
6
Cov
0%
TO_JSON
42.0
type
2.0
BEGIN
2.0
CRAP 15.3
1 package Chart::Plotly::Trace::Parcats;
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::Parcats::Dimension;
10 use Chart::Plotly::Trace::Parcats::Domain;
11 use Chart::Plotly::Trace::Parcats::Labelfont;
12 use Chart::Plotly::Trace::Parcats::Legendgrouptitle;
13 use Chart::Plotly::Trace::Parcats::Line;
14 use Chart::Plotly::Trace::Parcats::Stream;
15 use Chart::Plotly::Trace::Parcats::Tickfont;
16 use Chart::Plotly::Trace::Parcats::Transform;
17  
18 our $VERSION = '0.042'; # VERSION
19  
20 # ABSTRACT: Parallel categories diagram for multidimensional categorical data.
21  
22 sub TO_JSON {
23 my $self = shift;
24 my $extra_args = $self->extra_args // {};
25 my $meta = $self->meta;
26 my %hash = %$self;
27 for my $name ( sort keys %hash ) {
28 my $attr = $meta->get_attribute($name);
29 if ( defined $attr ) {
30 my $value = $hash{$name};
31 my $type = $attr->type_constraint;
32 if ( $type && $type->equals('Bool') ) {
33 $hash{$name} = $value ? \1 : \0;
34 }
35 }
36 }
37 my $plotly_meta = delete $hash{'pmeta'};
38 if ( defined $plotly_meta ) {
39 $hash{'meta'} = $plotly_meta;
40 }
41 %hash = ( %hash, %$extra_args );
42 delete $hash{'extra_args'};
43 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
44 $hash{type} = $self->type();
45 }
46 return \%hash;
47 }
48  
49 sub type {
50 my @components = split( /::/, __PACKAGE__ );
51 return lc( $components[-1] );
52 }
53  
54 has arrangement => (
55 is => "rw",
56 isa => enum( [ "perpendicular", "freeform", "fixed" ] ),
57 documentation =>
58 "Sets the drag interaction mode for categories and dimensions. If `perpendicular`, the categories can only move along a line perpendicular to the paths. If `freeform`, the categories can freely move on the plane. If `fixed`, the categories and dimensions are stationary.",
59 );
60  
61 has bundlecolors => ( is => "rw",
62 isa => "Bool",
63 documentation => "Sort paths so that like colors are bundled together within each category.",
64 );
65  
66 has counts => (
67 is => "rw",
68 isa => "Num|ArrayRef[Num]",
69 documentation =>
70 "The number of observations represented by each state. Defaults to 1 so that each state represents one observation",
71 );
72  
73 has countssrc => ( is => "rw",
74 isa => "Str",
75 documentation => "Sets the source reference on Chart Studio Cloud for `counts`.",
76 );
77  
78 has dimensions => ( is => "rw",
79 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Parcats::Dimension]", );
80  
81 has domain => ( is => "rw",
82 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Parcats::Domain", );
83  
84 has hoverinfo => (
85 is => "rw",
86 isa => "Str",
87 documentation =>
88 "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.",
89 );
90  
91 has hoveron => (
92 is => "rw",
93 isa => enum( [ "category", "color", "dimension" ] ),
94 documentation =>
95 "Sets the hover interaction mode for the parcats diagram. If `category`, hover interaction take place per category. If `color`, hover interactions take place per color per category. If `dimension`, hover interactions take place across all categories per dimension.",
96 );
97  
98 has hovertemplate => (
99 is => "rw",
100 isa => "Str",
101 documentation =>
102 "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 `count`, `probability`, `category`, `categorycount`, `colorcount` and `bandcolorcount`. 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>`.",
103 );
104  
105 has labelfont => ( is => "rw",
106 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Parcats::Labelfont", );
107  
108 has legendgrouptitle => ( is => "rw",
109 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Parcats::Legendgrouptitle", );
110  
111 has line => ( is => "rw",
112 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Parcats::Line", );
113  
114 has pmeta => (
115 is => "rw",
116 isa => "Any|ArrayRef[Any]",
117 documentation =>
118 "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.",
119 );
120  
121 has metasrc => ( is => "rw",
122 isa => "Str",
123 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
124 );
125  
126 has name => ( is => "rw",
127 isa => "Str",
128 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
129 );
130  
131 has sortpaths => (
132 is => "rw",
133 isa => enum( [ "forward", "backward" ] ),
134 documentation =>
135 "Sets the path sorting algorithm. If `forward`, sort paths based on dimension categories from left to right. If `backward`, sort paths based on dimensions categories from right to left.",
136 );
137  
138 has stream => ( is => "rw",
139 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Parcats::Stream", );
140  
141 has tickfont => ( is => "rw",
142 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Parcats::Tickfont", );
143  
144 has transforms => ( is => "rw",
145 isa => "ArrayRef|ArrayRef[Chart::Plotly::Trace::Parcats::Transform]", );
146  
147 has uid => (
148 is => "rw",
149 isa => "Str",
150 documentation =>
151 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
152 );
153  
154 has uirevision => (
155 is => "rw",
156 isa => "Any",
157 documentation =>
158 "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.",
159 );
160  
161 has visible => (
162 is => "rw",
163 documentation =>
164 "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).",
165 );
166  
167 __PACKAGE__->meta->make_immutable();
168 1;
169  
170 __END__