Chart/Plotly/Trace/Sankey/Node.pm untested

filter: Statementstmt 0.0% 0 / 57 Branchbran 0.0% 0 / 10 Conditioncond 0.0% 0 / 8 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 87 CC 5 SCAR 27.7
CC
5
Cov
0%
TO_JSON
30.0
BEGIN
2.0
BEGIN
2.0
CRAP 16.0
1 package Chart::Plotly::Trace::Sankey::Node;
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::Sankey::Node::Hoverlabel;
10 use Chart::Plotly::Trace::Sankey::Node::Line;
11  
12 our $VERSION = '0.042'; # VERSION
13  
14 # ABSTRACT: This attribute is one of the possible options for the trace sankey.
15  
16 sub TO_JSON {
17 my $self = shift;
18 my $extra_args = $self->extra_args // {};
19 my $meta = $self->meta;
20 my %hash = %$self;
21 for my $name ( sort keys %hash ) {
22 my $attr = $meta->get_attribute($name);
23 if ( defined $attr ) {
24 my $value = $hash{$name};
25 my $type = $attr->type_constraint;
26 if ( $type && $type->equals('Bool') ) {
27 $hash{$name} = $value ? \1 : \0;
28 }
29 }
30 }
31 %hash = ( %hash, %$extra_args );
32 delete $hash{'extra_args'};
33 if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
34 $hash{type} = $self->type();
35 }
36 return \%hash;
37 }
38  
39 has color => (
40 is => "rw",
41 isa => "Str|ArrayRef[Str]",
42 documentation =>
43 "Sets the `node` color. It can be a single value, or an array for specifying color for each `node`. If `node.color` is omitted, then the default `Plotly` color palette will be cycled through to have a variety of colors. These defaults are not fully opaque, to allow some visibility of what is beneath the node.",
44 );
45  
46 has colorsrc => ( is => "rw",
47 isa => "Str",
48 documentation => "Sets the source reference on Chart Studio Cloud for `color`.",
49 );
50  
51 has customdata => ( is => "rw",
52 isa => "ArrayRef|PDL",
53 documentation => "Assigns extra data to each node.",
54 );
55  
56 has customdatasrc => ( is => "rw",
57 isa => "Str",
58 documentation => "Sets the source reference on Chart Studio Cloud for `customdata`.",
59 );
60  
61 has description => ( is => "ro",
62 default => "The nodes of the Sankey plot.", );
63  
64 has groups => (
65 is => "rw",
66 isa => "ArrayRef|PDL",
67 documentation =>
68 "Groups of nodes. Each group is defined by an array with the indices of the nodes it contains. Multiple groups can be specified.",
69 );
70  
71 has hoverinfo => (
72 is => "rw",
73 isa => enum( [ "all", "none", "skip" ] ),
74 documentation =>
75 "Determines which trace information appear when hovering nodes. If `none` or `skip` are set, no information is displayed upon hovering. But, if `none` is set, click and hover events are still fired.",
76 );
77  
78 has hoverlabel => ( is => "rw",
79 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Sankey::Node::Hoverlabel", );
80  
81 has hovertemplate => (
82 is => "rw",
83 isa => "Str|ArrayRef[Str]",
84 documentation =>
85 "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 `value` and `label`. 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>`.",
86 );
87  
88 has hovertemplatesrc => ( is => "rw",
89 isa => "Str",
90 documentation => "Sets the source reference on Chart Studio Cloud for `hovertemplate`.",
91 );
92  
93 has label => ( is => "rw",
94 isa => "ArrayRef|PDL",
95 documentation => "The shown name of the node.",
96 );
97  
98 has labelsrc => ( is => "rw",
99 isa => "Str",
100 documentation => "Sets the source reference on Chart Studio Cloud for `label`.",
101 );
102  
103 has line => ( is => "rw",
104 isa => "Maybe[HashRef]|Chart::Plotly::Trace::Sankey::Node::Line", );
105  
106 has pad => ( is => "rw",
107 isa => "Num",
108 documentation => "Sets the padding (in px) between the `nodes`.",
109 );
110  
111 has thickness => ( is => "rw",
112 isa => "Num",
113 documentation => "Sets the thickness (in px) of the `nodes`.",
114 );
115  
116 has x => ( is => "rw",
117 isa => "ArrayRef|PDL",
118 documentation => "The normalized horizontal position of the node.",
119 );
120  
121 has xsrc => ( is => "rw",
122 isa => "Str",
123 documentation => "Sets the source reference on Chart Studio Cloud for `x`.",
124 );
125  
126 has y => ( is => "rw",
127 isa => "ArrayRef|PDL",
128 documentation => "The normalized vertical position of the node.",
129 );
130  
131 has ysrc => ( is => "rw",
132 isa => "Str",
133 documentation => "Sets the source reference on Chart Studio Cloud for `y`.",
134 );
135  
136 __PACKAGE__->meta->make_immutable();
137 1;
138  
139 __END__