Chart/Plotly/Trace/Table.pm untested

filter: Statementstmt 0.0% 0 / 76 Branchbran 0.0% 0 / 12 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 11 Podpod 0.0% 0 / 2 totaltotal 0.0% 0 / 114 CC 6 SCAR 28.3
CC
6
Cov
0%
TO_JSON
42.0
type
2.0
BEGIN
2.0
CRAP 17.0
1 package Chart::Plotly::Trace::Table;
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::Table::Cells;
10 use Chart::Plotly::Trace::Table::Domain;
11 use Chart::Plotly::Trace::Table::Header;
12 use Chart::Plotly::Trace::Table::Hoverlabel;
13 use Chart::Plotly::Trace::Table::Legendgrouptitle;
14 use Chart::Plotly::Trace::Table::Stream;
15  
16 our $VERSION = '0.042'; # VERSION
17  
18 # ABSTRACT: Table view for detailed data viewing. The data are arranged in a grid of rows and columns. Most styling can be specified for columns, rows or individual cells. Table is using a column-major order, ie. the grid is represented as a vector of column vectors.
19  
20 sub TO_JSON {
21 my $self = shift;
22 my $extra_args = $self->extra_args // {};
23 my $meta = $self->meta;
24 my %hash = %$self;
25 for my $name ( sort keys %hash ) {
26 my $attr = $meta->get_attribute($name);
27 if ( defined $attr ) {
28 my $value = $hash{$name};
29 my $type = $attr->type_constraint;
30 if ( $type && $type->equals('Bool') ) {
31 $hash{$name} = $value ? \1 : \0;
32 }
33 }
34 }
35 my $plotly_meta = delete $hash{'pmeta'};
36 if ( defined $plotly_meta ) {
37 $hash{'meta'} = $plotly_meta;
38 }
39 %hash = ( %hash, %$extra_args );
40 delete $hash{'extra_args'};
41 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
42 $hash{type} = $self->type();
43 }
44 return \%hash;
45 }
46  
47 sub type {
48 my @components = split( /::/, __PACKAGE__ );
49 return lc( $components[-1] );
50 }
51  
52 has cells => ( is => "rw",
53 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Table::Cells", );
54  
55 has columnorder => (
56 is => "rw",
57 isa => "ArrayRef|PDL",
58 documentation =>
59 "Specifies the rendered order of the data columns; for example, a value `2` at position `0` means that column index `0` in the data will be rendered as the third column, as columns have an index base of zero.",
60 );
61  
62 has columnordersrc => ( is => "rw",
63 isa => "Str",
64 documentation => "Sets the source reference on Chart Studio Cloud for `columnorder`.",
65 );
66  
67 has columnwidth => (
68 is => "rw",
69 isa => "Num|ArrayRef[Num]",
70 documentation =>
71 "The width of columns expressed as a ratio. Columns fill the available width in proportion of their specified column widths.",
72 );
73  
74 has columnwidthsrc => ( is => "rw",
75 isa => "Str",
76 documentation => "Sets the source reference on Chart Studio Cloud for `columnwidth`.",
77 );
78  
79 has customdata => (
80 is => "rw",
81 isa => "ArrayRef|PDL",
82 documentation =>
83 "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",
84 );
85  
86 has customdatasrc => ( is => "rw",
87 isa => "Str",
88 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
89 );
90  
91 has domain => ( is => "rw",
92 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Table::Domain", );
93  
94 has header => ( is => "rw",
95 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Table::Header", );
96  
97 has hoverinfo => (
98 is => "rw",
99 isa => "Str|ArrayRef[Str]",
100 documentation =>
101 "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.",
102 );
103  
104 has hoverinfosrc => ( is => "rw",
105 isa => "Str",
106 documentation => "Sets the source reference on Chart Studio Cloud for `hoverinfo`.",
107 );
108  
109 has hoverlabel => ( is => "rw",
110 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Table::Hoverlabel", );
111  
112 has ids => (
113 is => "rw",
114 isa => "ArrayRef|PDL",
115 documentation =>
116 "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.",
117 );
118  
119 has idssrc => ( is => "rw",
120 isa => "Str",
121 documentation => "Sets the source reference on Chart Studio Cloud for `ids`.",
122 );
123  
124 has legendgrouptitle => ( is => "rw",
125 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Table::Legendgrouptitle", );
126  
127 has legendrank => (
128 is => "rw",
129 isa => "Num",
130 documentation =>
131 "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.",
132 );
133  
134 has pmeta => (
135 is => "rw",
136 isa => "Any|ArrayRef[Any]",
137 documentation =>
138 "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.",
139 );
140  
141 has metasrc => ( is => "rw",
142 isa => "Str",
143 documentation => "Sets the source reference on Chart Studio Cloud for `meta`.",
144 );
145  
146 has name => ( is => "rw",
147 isa => "Str",
148 documentation => "Sets the trace name. The trace name appear as the legend item and on hover.",
149 );
150  
151 has stream => ( is => "rw",
152 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Table::Stream", );
153  
154 has uid => (
155 is => "rw",
156 isa => "Str",
157 documentation =>
158 "Assign an id to this trace, Use this to provide object constancy between traces during animations and transitions.",
159 );
160  
161 has uirevision => (
162 is => "rw",
163 isa => "Any",
164 documentation =>
165 "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.",
166 );
167  
168 has visible => (
169 is => "rw",
170 documentation =>
171 "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).",
172 );
173  
174 __PACKAGE__->meta->make_immutable();
175 1;
176  
177 __END__