File Coverage

blib/lib/Chart/Plotly/Trace/Scatter/Textfont.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             package Chart::Plotly::Trace::Scatter::Textfont;
2 3     3   20 use Moose;
  3         6  
  3         18  
3 3     3   16179 use MooseX::ExtraArgs;
  3         7  
  3         20  
4 3     3   5483 use Moose::Util::TypeConstraints qw(enum union);
  3         6  
  3         21  
5             if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
6             Moose::Util::TypeConstraints::type('PDL');
7             }
8              
9             our $VERSION = '0.039'; # VERSION
10              
11             # ABSTRACT: This attribute is one of the possible options for the trace scatter.
12              
13             sub TO_JSON {
14 0     0 1   my $self = shift;
15 0   0       my $extra_args = $self->extra_args // {};
16 0           my $meta = $self->meta;
17 0           my %hash = %$self;
18 0           for my $name ( sort keys %hash ) {
19 0           my $attr = $meta->get_attribute($name);
20 0 0         if ( defined $attr ) {
21 0           my $value = $hash{$name};
22 0           my $type = $attr->type_constraint;
23 0 0 0       if ( $type && $type->equals('Bool') ) {
24 0 0         $hash{$name} = $value ? \1 : \0;
25             }
26             }
27             }
28 0           %hash = ( %hash, %$extra_args );
29 0           delete $hash{'extra_args'};
30 0 0 0       if ( $self->can('type') && ( !defined $hash{'type'} ) ) {
31 0           $hash{type} = $self->type();
32             }
33 0           return \%hash;
34             }
35              
36             has color => ( is => "rw",
37             isa => "Str|ArrayRef[Str]", );
38              
39             has colorsrc => ( is => "rw",
40             isa => "Str",
41             documentation => "Sets the source reference on plot.ly for color .",
42             );
43              
44             has description => ( is => "ro",
45             default => "Sets the text font.", );
46              
47             has family => (
48             is => "rw",
49             isa => "Str|ArrayRef[Str]",
50             documentation =>
51             "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 plotly service (at https://plot.ly 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*.",
52             );
53              
54             has familysrc => ( is => "rw",
55             isa => "Str",
56             documentation => "Sets the source reference on plot.ly for family .",
57             );
58              
59             has size => ( is => "rw",
60             isa => "Num|ArrayRef[Num]", );
61              
62             has sizesrc => ( is => "rw",
63             isa => "Str",
64             documentation => "Sets the source reference on plot.ly for size .",
65             );
66              
67             __PACKAGE__->meta->make_immutable();
68             1;
69              
70             __END__
71              
72             =pod
73              
74             =encoding utf-8
75              
76             =head1 NAME
77              
78             Chart::Plotly::Trace::Scatter::Textfont - This attribute is one of the possible options for the trace scatter.
79              
80             =head1 VERSION
81              
82             version 0.039
83              
84             =head1 SYNOPSIS
85              
86             use HTML::Show;
87             use Chart::Plotly;
88             use Chart::Plotly::Trace::Scatter;
89             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
90            
91             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
92              
93             =head1 DESCRIPTION
94              
95             This attribute is part of the possible options for the trace scatter.
96              
97             This file has been autogenerated from the official plotly.js source.
98              
99             If you like Plotly, please support them: L<https://plot.ly/>
100             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
101              
102             Full reference: L<https://plot.ly/javascript/reference/#scatter>
103              
104             =head1 DISCLAIMER
105              
106             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
107             But I think plotly.js is a great library and I want to use it with perl.
108              
109             =head1 METHODS
110              
111             =head2 TO_JSON
112              
113             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
114              
115             =head1 ATTRIBUTES
116              
117             =over
118              
119             =item * color
120              
121             =item * colorsrc
122              
123             Sets the source reference on plot.ly for color .
124              
125             =item * description
126              
127             =item * family
128              
129             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 plotly service (at https://plot.ly 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*.
130              
131             =item * familysrc
132              
133             Sets the source reference on plot.ly for family .
134              
135             =item * size
136              
137             =item * sizesrc
138              
139             Sets the source reference on plot.ly for size .
140              
141             =back
142              
143             =head1 AUTHOR
144              
145             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
146              
147             =head1 COPYRIGHT AND LICENSE
148              
149             This software is Copyright (c) 2020 by Pablo Rodríguez González.
150              
151             This is free software, licensed under:
152              
153             The MIT (X11) License
154              
155             =cut