line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Chart::Plotly::Trace::Funnel::Hoverlabel; |
2
|
1
|
|
|
1
|
|
7
|
use Moose; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
3
|
1
|
|
|
1
|
|
7302
|
use MooseX::ExtraArgs; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
11
|
|
4
|
1
|
|
|
1
|
|
2278
|
use Moose::Util::TypeConstraints qw(enum union); |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
12
|
|
5
|
|
|
|
|
|
|
if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) { |
6
|
|
|
|
|
|
|
Moose::Util::TypeConstraints::type('PDL'); |
7
|
|
|
|
|
|
|
} |
8
|
|
|
|
|
|
|
|
9
|
1
|
|
|
1
|
|
1421
|
use Chart::Plotly::Trace::Funnel::Hoverlabel::Font; |
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
12373
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '0.041'; # VERSION |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# ABSTRACT: This attribute is one of the possible options for the trace funnel. |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub TO_JSON { |
16
|
0
|
|
|
0
|
1
|
|
my $self = shift; |
17
|
0
|
|
0
|
|
|
|
my $extra_args = $self->extra_args // {}; |
18
|
0
|
|
|
|
|
|
my $meta = $self->meta; |
19
|
0
|
|
|
|
|
|
my %hash = %$self; |
20
|
0
|
|
|
|
|
|
for my $name ( sort keys %hash ) { |
21
|
0
|
|
|
|
|
|
my $attr = $meta->get_attribute($name); |
22
|
0
|
0
|
|
|
|
|
if ( defined $attr ) { |
23
|
0
|
|
|
|
|
|
my $value = $hash{$name}; |
24
|
0
|
|
|
|
|
|
my $type = $attr->type_constraint; |
25
|
0
|
0
|
0
|
|
|
|
if ( $type && $type->equals('Bool') ) { |
26
|
0
|
0
|
|
|
|
|
$hash{$name} = $value ? \1 : \0; |
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
} |
30
|
0
|
|
|
|
|
|
%hash = ( %hash, %$extra_args ); |
31
|
0
|
|
|
|
|
|
delete $hash{'extra_args'}; |
32
|
0
|
0
|
0
|
|
|
|
if ( $self->can('type') && ( !defined $hash{'type'} ) ) { |
33
|
0
|
|
|
|
|
|
$hash{type} = $self->type(); |
34
|
|
|
|
|
|
|
} |
35
|
0
|
|
|
|
|
|
return \%hash; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
has align => ( |
39
|
|
|
|
|
|
|
is => "rw", |
40
|
|
|
|
|
|
|
isa => union( [ enum( [ "left", "right", "auto" ] ), "ArrayRef" ] ), |
41
|
|
|
|
|
|
|
documentation => |
42
|
|
|
|
|
|
|
"Sets the horizontal alignment of the text content within hover label box. Has an effect only if the hover label text spans more two or more lines", |
43
|
|
|
|
|
|
|
); |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
has alignsrc => ( is => "rw", |
46
|
|
|
|
|
|
|
isa => "Str", |
47
|
|
|
|
|
|
|
documentation => "Sets the source reference on plot.ly for align .", |
48
|
|
|
|
|
|
|
); |
49
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
has bgcolor => ( is => "rw", |
51
|
|
|
|
|
|
|
isa => "Str|ArrayRef[Str]", |
52
|
|
|
|
|
|
|
documentation => "Sets the background color of the hover labels for this trace", |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has bgcolorsrc => ( is => "rw", |
56
|
|
|
|
|
|
|
isa => "Str", |
57
|
|
|
|
|
|
|
documentation => "Sets the source reference on plot.ly for bgcolor .", |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
has bordercolor => ( is => "rw", |
61
|
|
|
|
|
|
|
isa => "Str|ArrayRef[Str]", |
62
|
|
|
|
|
|
|
documentation => "Sets the border color of the hover labels for this trace.", |
63
|
|
|
|
|
|
|
); |
64
|
|
|
|
|
|
|
|
65
|
|
|
|
|
|
|
has bordercolorsrc => ( is => "rw", |
66
|
|
|
|
|
|
|
isa => "Str", |
67
|
|
|
|
|
|
|
documentation => "Sets the source reference on plot.ly for bordercolor .", |
68
|
|
|
|
|
|
|
); |
69
|
|
|
|
|
|
|
|
70
|
|
|
|
|
|
|
has font => ( is => "rw", |
71
|
|
|
|
|
|
|
isa => "Maybe[HashRef]|Chart::Plotly::Trace::Funnel::Hoverlabel::Font", ); |
72
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
has namelength => ( |
74
|
|
|
|
|
|
|
is => "rw", |
75
|
|
|
|
|
|
|
isa => "Int|ArrayRef[Int]", |
76
|
|
|
|
|
|
|
documentation => |
77
|
|
|
|
|
|
|
"Sets the default length (in number of characters) of the trace name in the hover labels for all traces. -1 shows the whole name regardless of length. 0-3 shows the first 0-3 characters, and an integer >3 will show the whole name if it is less than that many characters, but if it is longer, will truncate to `namelength - 3` characters and add an ellipsis.", |
78
|
|
|
|
|
|
|
); |
79
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
has namelengthsrc => ( is => "rw", |
81
|
|
|
|
|
|
|
isa => "Str", |
82
|
|
|
|
|
|
|
documentation => "Sets the source reference on plot.ly for namelength .", |
83
|
|
|
|
|
|
|
); |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable(); |
86
|
|
|
|
|
|
|
1; |
87
|
|
|
|
|
|
|
|
88
|
|
|
|
|
|
|
__END__ |
89
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
=pod |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
=encoding utf-8 |
93
|
|
|
|
|
|
|
|
94
|
|
|
|
|
|
|
=head1 NAME |
95
|
|
|
|
|
|
|
|
96
|
|
|
|
|
|
|
Chart::Plotly::Trace::Funnel::Hoverlabel - This attribute is one of the possible options for the trace funnel. |
97
|
|
|
|
|
|
|
|
98
|
|
|
|
|
|
|
=head1 VERSION |
99
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
version 0.041 |
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 SYNOPSIS |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
use Chart::Plotly; |
105
|
|
|
|
|
|
|
use Chart::Plotly::Plot; |
106
|
|
|
|
|
|
|
use JSON; |
107
|
|
|
|
|
|
|
use Chart::Plotly::Trace::Funnel; |
108
|
|
|
|
|
|
|
|
109
|
|
|
|
|
|
|
# Example from https://github.com/plotly/plotly.js/blob/b93e3a5a83b6561ac6258a59f274b5fc87630c3e/test/image/mocks/funnel_11.json |
110
|
|
|
|
|
|
|
my $trace1 = Chart::Plotly::Trace::Funnel->new({'orientation' => 'v', 'marker' => {'color' => 'rgb(255, 102, 97)', }, 'y' => [13.23, 22.7, 26.06, ], 'x' => ['Half Dose', 'Full Dose', 'Double Dose', ], 'name' => 'Orange Juice', }); |
111
|
|
|
|
|
|
|
|
112
|
|
|
|
|
|
|
my $trace2 = Chart::Plotly::Trace::Funnel->new({'name' => 'Vitamin C', 'marker' => {'color' => 'rgb(0, 196, 200)', }, 'y' => [7.98, 16.77, 26.14, ], 'x' => ['Half Dose', 'Full Dose', 'Double Dose', ], 'orientation' => 'v', }); |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
my $trace3 = Chart::Plotly::Trace::Funnel->new({'name' => 'Std Dev - OJ', 'x' => ['Half Dose', 'Full Dose', 'Double Dose', ], 'y' => [1.4102837, 1.236752, 0.8396031, ], 'visible' => JSON::false, 'orientation' => 'v', }); |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
my $trace4 = Chart::Plotly::Trace::Funnel->new({'y' => [0.868562, 0.7954104, 1.5171757, ], 'x' => ['Half Dose', 'Full Dose', 'Double Dose', ], 'name' => 'Std Dev - VC', 'orientation' => 'v', 'visible' => JSON::false, }); |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
|
119
|
|
|
|
|
|
|
my $plot = Chart::Plotly::Plot->new( |
120
|
|
|
|
|
|
|
traces => [$trace1, $trace2, $trace3, $trace4, ], |
121
|
|
|
|
|
|
|
layout => |
122
|
|
|
|
|
|
|
{'autosize' => JSON::false, 'hidesources' => JSON::false, 'plot_bgcolor' => 'rgb(217, 217, 217)', 'font' => {'color' => '#000', 'size' => 12, 'family' => 'Arial, sans-serif', }, 'width' => 600, 'separators' => '.,', 'legend' => {'xanchor' => 'left', 'font' => {'size' => 16, 'family' => '', 'color' => 'rgb(0, 0, 0)', }, 'bgcolor' => 'rgba(255, 255, 255, 0)', 'bordercolor' => 'rgba(0, 0, 0, 0)', 'yanchor' => 'auto', 'x' => 1.02, 'y' => 0.931907250442406, 'borderwidth' => 1, 'traceorder' => 'normal', }, 'funnelgroupgap' => 0, 'funnelgap' => 0.2, 'annotations' => [{'tag' => '', 'yatype' => 'linear', 'showarrow' => JSON::false, 'xanchor' => 'auto', 'bgcolor' => 'rgba(0,0,0,0)', 'arrowhead' => 1, 'yref' => 'paper', 'ax' => -10, 'align' => 'center', 'yanchor' => 'auto', 'xatype' => 'category', 'bordercolor' => '', 'ref' => 'paper', 'text' => '<b>Supplement</b>', 'x' => 1.3479735318445, 'y' => 0.998214285714286, 'opacity' => 1, 'arrowwidth' => 0, 'font' => {'size' => 18, 'family' => '', 'color' => '', }, 'ay' => -26.7109375, 'arrowcolor' => '', 'borderpad' => 1, 'borderwidth' => 1, 'xref' => 'paper', 'arrowsize' => 1, }, ], 'height' => 440, 'dragmode' => 'zoom', 'hovermode' => 'x', 'paper_bgcolor' => '#fff', 'boxmode' => 'overlay', 'showlegend' => JSON::true, 'titlefont' => {'family' => '', 'size' => 16, 'color' => '', }, 'title' => 'Grouped Funnel Chart', 'margin' => {'r' => 0, 't' => 80, 'b' => 80, 'l' => 80, 'autoexpand' => JSON::true, 'pad' => 2, }, 'yaxis' => {'gridcolor' => 'rgb(255, 255, 255)', 'autotick' => JSON::true, 'ticks' => '', 'tickfont' => {'color' => '', 'size' => 16, 'family' => '', }, 'mirror' => JSON::true, 'tickangle' => 0, 'domain' => [0, 1, ], 'anchor' => 'x', 'showgrid' => JSON::true, 'exponentformat' => 'e', 'tick0' => 0, 'showticklabels' => JSON::true, 'nticks' => 0, 'zerolinewidth' => 1, 'zeroline' => JSON::false, 'position' => 0, 'range' => [0, 29.1128165263158, ], 'dtick' => 5, 'showexponent' => 'all', 'showline' => JSON::false, 'linecolor' => '#000', 'type' => 'linear', 'linewidth' => 0.1, 'overlaying' => JSON::false, 'ticklen' => 5, 'rangemode' => 'normal', 'tickwidth' => 1, 'tickcolor' => '#000', 'title' => 'Length', 'autorange' => JSON::true, 'titlefont' => {'size' => 16, 'family' => '', 'color' => '', }, 'zerolinecolor' => '#000', 'gridwidth' => 1.9, }, 'funnelmode' => 'group', 'xaxis' => {'ticks' => '', 'autotick' => JSON::true, 'gridcolor' => 'rgb(255, 255, 255)', 'tickfont' => {'color' => '', 'family' => '', 'size' => 16, }, 'mirror' => JSON::true, 'anchor' => 'y', 'tickangle' => 0, 'domain' => [0, 1, ], 'showgrid' => JSON::true, 'exponentformat' => 'e', 'tick0' => 0, 'showticklabels' => JSON::true, 'range' => [-0.5, 2.5, ], 'nticks' => 0, 'zerolinewidth' => 1, 'zeroline' => JSON::false, 'position' => 0, 'showexponent' => 'all', 'dtick' => 1, 'showline' => JSON::false, 'type' => 'category', 'linecolor' => '#000', 'overlaying' => JSON::false, 'linewidth' => 0.1, 'ticklen' => 5, 'rangemode' => 'normal', 'titlefont' => {'size' => 16, 'family' => '', 'color' => '', }, 'autorange' => JSON::true, 'title' => 'Dose (mg)', 'tickwidth' => 1, 'tickcolor' => '#000', 'gridwidth' => 1.9, 'zerolinecolor' => '#000', }, } |
123
|
|
|
|
|
|
|
); |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
Chart::Plotly::show_plot($plot); |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 DESCRIPTION |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
This attribute is part of the possible options for the trace funnel. |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
This file has been autogenerated from the official plotly.js source. |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
If you like Plotly, please support them: L<https://plot.ly/> |
134
|
|
|
|
|
|
|
Open source announcement: L<https://plot.ly/javascript/open-source-announcement/> |
135
|
|
|
|
|
|
|
|
136
|
|
|
|
|
|
|
Full reference: L<https://plot.ly/javascript/reference/#funnel> |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=head1 DISCLAIMER |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly. |
141
|
|
|
|
|
|
|
But I think plotly.js is a great library and I want to use it with perl. |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
=head1 METHODS |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
=head2 TO_JSON |
146
|
|
|
|
|
|
|
|
147
|
|
|
|
|
|
|
Serialize the trace to JSON. This method should be called only by L<JSON> serializer. |
148
|
|
|
|
|
|
|
|
149
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
150
|
|
|
|
|
|
|
|
151
|
|
|
|
|
|
|
=over |
152
|
|
|
|
|
|
|
|
153
|
|
|
|
|
|
|
=item * align |
154
|
|
|
|
|
|
|
|
155
|
|
|
|
|
|
|
Sets the horizontal alignment of the text content within hover label box. Has an effect only if the hover label text spans more two or more lines |
156
|
|
|
|
|
|
|
|
157
|
|
|
|
|
|
|
=item * alignsrc |
158
|
|
|
|
|
|
|
|
159
|
|
|
|
|
|
|
Sets the source reference on plot.ly for align . |
160
|
|
|
|
|
|
|
|
161
|
|
|
|
|
|
|
=item * bgcolor |
162
|
|
|
|
|
|
|
|
163
|
|
|
|
|
|
|
Sets the background color of the hover labels for this trace |
164
|
|
|
|
|
|
|
|
165
|
|
|
|
|
|
|
=item * bgcolorsrc |
166
|
|
|
|
|
|
|
|
167
|
|
|
|
|
|
|
Sets the source reference on plot.ly for bgcolor . |
168
|
|
|
|
|
|
|
|
169
|
|
|
|
|
|
|
=item * bordercolor |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
Sets the border color of the hover labels for this trace. |
172
|
|
|
|
|
|
|
|
173
|
|
|
|
|
|
|
=item * bordercolorsrc |
174
|
|
|
|
|
|
|
|
175
|
|
|
|
|
|
|
Sets the source reference on plot.ly for bordercolor . |
176
|
|
|
|
|
|
|
|
177
|
|
|
|
|
|
|
=item * font |
178
|
|
|
|
|
|
|
|
179
|
|
|
|
|
|
|
=item * namelength |
180
|
|
|
|
|
|
|
|
181
|
|
|
|
|
|
|
Sets the default length (in number of characters) of the trace name in the hover labels for all traces. -1 shows the whole name regardless of length. 0-3 shows the first 0-3 characters, and an integer >3 will show the whole name if it is less than that many characters, but if it is longer, will truncate to `namelength - 3` characters and add an ellipsis. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=item * namelengthsrc |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Sets the source reference on plot.ly for namelength . |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=back |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
=head1 AUTHOR |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com> |
192
|
|
|
|
|
|
|
|
193
|
|
|
|
|
|
|
=head1 COPYRIGHT AND LICENSE |
194
|
|
|
|
|
|
|
|
195
|
|
|
|
|
|
|
This software is Copyright (c) 2020 by Pablo Rodríguez González. |
196
|
|
|
|
|
|
|
|
197
|
|
|
|
|
|
|
This is free software, licensed under: |
198
|
|
|
|
|
|
|
|
199
|
|
|
|
|
|
|
The MIT (X11) License |
200
|
|
|
|
|
|
|
|
201
|
|
|
|
|
|
|
=cut |