File Coverage

blib/lib/Chart/Plotly/Trace/Scatter/Stream.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   25 use MooseX::ExtraArgs;
  4         8  
  4         31  
3 4     4   22798 use Moose::Util::TypeConstraints qw(enum union);
  4         10  
  4         30  
4 4     4   7508 if ( !defined Moose::Util::TypeConstraints::find_type_constraint('PDL') ) {
  4         9  
  4         38  
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 maxpoints => (
35             is => "rw",
36             isa => "Num",
37             documentation =>
38             "Sets the maximum number of points to keep on the plots from an incoming stream. If `maxpoints` is set to *50*, only the newest 50 points will be displayed on the plot.",
39             );
40              
41             has token => (
42             is => "rw",
43             isa => "Str",
44             documentation =>
45             "The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details.",
46             );
47              
48             __PACKAGE__->meta->make_immutable();
49             1;
50              
51              
52             =pod
53              
54             =encoding utf-8
55              
56             =head1 NAME
57              
58             Chart::Plotly::Trace::Scatter::Stream - This attribute is one of the possible options for the trace scatter.
59              
60             =head1 VERSION
61              
62             version 0.042
63              
64             =head1 SYNOPSIS
65              
66             use HTML::Show;
67             use Chart::Plotly;
68             use Chart::Plotly::Trace::Scatter;
69             my $scatter = Chart::Plotly::Trace::Scatter->new( x => [ 1 .. 5 ], y => [ 1 .. 5 ] );
70            
71             HTML::Show::show( Chart::Plotly::render_full_html( data => [$scatter] ) );
72              
73             =head1 DESCRIPTION
74              
75             This attribute is part of the possible options for the trace scatter.
76              
77             This file has been autogenerated from the official plotly.js source.
78              
79             If you like Plotly, please support them: L<https://plot.ly/>
80             Open source announcement: L<https://plot.ly/javascript/open-source-announcement/>
81              
82             Full reference: L<https://plot.ly/javascript/reference/#scatter>
83              
84             =head1 DISCLAIMER
85              
86             This is an unofficial Plotly Perl module. Currently I'm not affiliated in any way with Plotly.
87             But I think plotly.js is a great library and I want to use it with perl.
88              
89             =head1 METHODS
90              
91             =head2 TO_JSON
92              
93             Serialize the trace to JSON. This method should be called only by L<JSON> serializer.
94              
95             =head1 ATTRIBUTES
96              
97             =over
98              
99             =item * maxpoints
100              
101             Sets the maximum number of points to keep on the plots from an incoming stream. If `maxpoints` is set to *50*, only the newest 50 points will be displayed on the plot.
102              
103             =item * token
104              
105             The stream id number links a data trace on a plot with a stream. See https://chart-studio.plotly.com/settings for more details.
106              
107             =back
108              
109             =head1 AUTHOR
110              
111             Pablo Rodríguez González <pablo.rodriguez.gonzalez@gmail.com>
112              
113             =head1 COPYRIGHT AND LICENSE
114              
115             This software is Copyright (c) 2022 by Pablo Rodríguez González.
116              
117             This is free software, licensed under:
118              
119             The MIT (X11) License
120              
121             =cut