File Coverage

blib/lib/Chart/Plotly/Trace/Funnel/Legendgrouptitle/Font.pm
Criterion Covered Total %
statement 9 25 36.0
branch 0 8 0.0
condition 0 8 0.0
subroutine 3 4 75.0
pod 1 1 100.0
total 13 46 28.2


line stmt bran cond sub pod time code
1             use Moose;
2 1     1   7 use MooseX::ExtraArgs;
  1         2  
  1         9  
3 1     1   6443 use Moose::Util::TypeConstraints qw(enum union);
  1         3  
  1         7  
4 1     1   1829 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
  1         2  
  1         8  
5             Moose::Util::TypeConstraints::type('PDL');
6             }
7              
8             our $VERSION = '0.042'; # VERSION
9              
10             # ABSTRACT: This attribute is one of the possible options for the trace funnel.
11              
12             my $self = shift;
13             my $extra_args = $self->extra_args // {};
14 0     0 1   my $meta = $self->meta;
15 0   0       my %hash = %$self;
16 0           for my $name ( sort keys %hash ) {
17 0           my $attr = $meta->get_attribute($name);
18 0           if ( defined $attr ) {
19 0           my $value = $hash{$name};
20 0 0         my $type = $attr->type_constraint;
21 0           if ( $type && $type->equals('Bool') ) {
22 0           $hash{$name} = $value ? \1 : \0;
23 0 0 0       }
24 0 0         }
25             }
26             %hash = ( %hash, %$extra_args );
27             delete $hash{'extra_args'};
28 0           if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
29 0           $hash{type} = $self->type();
30 0 0 0       }
31 0           return \%hash;
32             }
33 0            
34             has color => ( is => "rw",
35             isa => "Str", );
36              
37             has description => ( is => "ro",
38             default => "Sets this legend group's title font.", );
39              
40             has family => (
41             is => "rw",
42             isa => "Str",
43             documentation =>
44             "HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*, *Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*, *PT Sans Narrow*, *Raleway*, *Times New Roman*.",
45             );
46              
47             has size => ( is => "rw",
48             isa => "Num", );
49              
50             __PACKAGE__->meta->make_immutable();
51             1;
52              
53              
54             =pod
55              
56             =encoding utf-8
57              
58             =head1 NAME
59              
60             Chart::Plotly::Trace::Funnel::Legendgrouptitle::Font - This attribute is one of the possible options for the trace funnel.
61              
62             =head1 VERSION
63              
64             version 0.042
65              
66             =head1 SYNOPSIS
67              
68             use Chart::Plotly;
69             use Chart::Plotly::Plot;
70             use JSON;
71             use Chart::Plotly::Trace::Funnel;
72            
73             # Example from https://github.com/plotly/plotly.js/blob/b93e3a5a83b6561ac6258a59f274b5fc87630c3e/test/image/mocks/funnel_11.json
74             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', });
75            
76             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', });
77            
78             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', });
79            
80             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, });
81            
82            
83             my $plot = Chart::Plotly::Plot->new(
84             traces => [$trace1, $trace2, $trace3, $trace4, ],
85             layout =>
86             {'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', }, }
87             );
88            
89             Chart::Plotly::show_plot($plot);
90              
91             =head1 DESCRIPTION
92              
93             This attribute is part of the possible options for the trace funnel.
94              
95             This file has been autogenerated from the official plotly.js source.
96              
97             If you like Plotly, please support them: L<https://plot.ly/>
98             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
99              
100             Full reference: L<https://plot.ly/javascript/reference/#funnel>
101              
102             =head1 DISCLAIMER
103              
104             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
105             But I think plotly.js is a great library and I want to use it with perl.
106              
107             =head1 METHODS
108              
109             =head2 TO_JSON
110              
111             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
112              
113             =head1 ATTRIBUTES
114              
115             =over
116              
117             =item * color
118              
119             =item * description
120              
121             =item * family
122              
123             HTML font family - the typeface that will be applied by the web browser. The web browser will only be able to apply a font if it is available on the system which it operates. Provide multiple font families, separated by commas, to indicate the preference in which to apply fonts if they aren't available on the system. The Chart Studio Cloud (at https://chart-studio.plotly.com or on-premise) generates images on a server, where only a select number of fonts are installed and supported. These include *Arial*, *Balto*, *Courier New*, *Droid Sans*,, *Droid Serif*, *Droid Sans Mono*, *Gravitas One*, *Old Standard TT*, *Open Sans*, *Overpass*, *PT Sans Narrow*, *Raleway*, *Times New Roman*.
124              
125             =item * size
126              
127             =back
128              
129             =head1 AUTHOR
130              
131             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
132              
133             =head1 COPYRIGHT AND LICENSE
134              
135             This software is Copyright (c) 2022 by Pablo Rodríguez González.
136              
137             This is free software, licensed under:
138              
139             The MIT (X11) License
140              
141             =cut