File Coverage

blib/lib/Chart/Plotly/Trace/Scatter/Line.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 4     4   26 use MooseX::ExtraArgs;
  4         8  
  4         26  
3 4     4   21842 use Moose::Util::TypeConstraints qw(enum union);
  4         9  
  4         28  
4 4     4   7032 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
  4         9  
  4         60  
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 scatter.
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             documentation => "Sets the line color.",
37             );
38              
39             has dash => (
40             is => "rw",
41             isa => "Str",
42             documentation =>
43             "Sets the dash style of lines. Set to a dash type string (*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*) or a dash length list in px (eg *5px,10px,2px,2px*).",
44             );
45              
46             has shape => (
47             is => "rw",
48             isa => enum( [ "linear", "spline", "hv", "vh", "hvh", "vhv" ] ),
49             documentation =>
50             "Determines the line shape. With *spline* the lines are drawn using spline interpolation. The other available values correspond to step-wise line shapes.",
51             );
52              
53             has simplify => (
54             is => "rw",
55             isa => "Bool",
56             documentation =>
57             "Simplifies lines by removing nearly-collinear points. When transitioning lines, it may be desirable to disable this so that the number of points along the resulting SVG path is unaffected.",
58             );
59              
60             has smoothing => (
61             is => "rw",
62             isa => "Num",
63             documentation =>
64             "Has an effect only if `shape` is set to *spline* Sets the amount of smoothing. *0* corresponds to no smoothing (equivalent to a *linear* shape).",
65             );
66              
67             has width => ( is => "rw",
68             isa => "Num",
69             documentation => "Sets the line width (in px).",
70             );
71              
72             __PACKAGE__->meta->make_immutable();
73             1;
74              
75              
76             =pod
77              
78             =encoding utf-8
79              
80             =head1 NAME
81              
82             Chart::Plotly::Trace::Scatter::Line - This attribute is one of the possible options for the trace scatter.
83              
84             =head1 VERSION
85              
86             version 0.042
87              
88             =head1 SYNOPSIS
89              
90             use HTML::Show;
91             use Chart::Plotly;
92             use Chart::Plotly::Trace::Scatter;
93             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
94            
95             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
96              
97             =head1 DESCRIPTION
98              
99             This attribute is part of the possible options for the trace scatter.
100              
101             This file has been autogenerated from the official plotly.js source.
102              
103             If you like Plotly, please support them: L<https://plot.ly/>
104             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
105              
106             Full reference: L<https://plot.ly/javascript/reference/#scatter>
107              
108             =head1 DISCLAIMER
109              
110             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
111             But I think plotly.js is a great library and I want to use it with perl.
112              
113             =head1 METHODS
114              
115             =head2 TO_JSON
116              
117             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
118              
119             =head1 ATTRIBUTES
120              
121             =over
122              
123             =item * color
124              
125             Sets the line color.
126              
127             =item * dash
128              
129             Sets the dash style of lines. Set to a dash type string (*solid*, *dot*, *dash*, *longdash*, *dashdot*, or *longdashdot*) or a dash length list in px (eg *5px,10px,2px,2px*).
130              
131             =item * shape
132              
133             Determines the line shape. With *spline* the lines are drawn using spline interpolation. The other available values correspond to step-wise line shapes.
134              
135             =item * simplify
136              
137             Simplifies lines by removing nearly-collinear points. When transitioning lines, it may be desirable to disable this so that the number of points along the resulting SVG path is unaffected.
138              
139             =item * smoothing
140              
141             Has an effect only if `shape` is set to *spline* Sets the amount of smoothing. *0* corresponds to no smoothing (equivalent to a *linear* shape).
142              
143             =item * width
144              
145             Sets the line width (in px).
146              
147             =back
148              
149             =head1 AUTHOR
150              
151             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
152              
153             =head1 COPYRIGHT AND LICENSE
154              
155             This software is Copyright (c) 2022 by Pablo Rodríguez González.
156              
157             This is free software, licensed under:
158              
159             The MIT (X11) License
160              
161             =cut