File Coverage

blib/lib/Chart/OFC/Dataset/Scatter.pm
Criterion Covered Total %
statement 23 23 100.0
branch 2 2 100.0
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 33 34 97.0


line stmt bran cond sub pod time code
1             package Chart::OFC::Dataset::Scatter;
2             $Chart::OFC::Dataset::Scatter::VERSION = '0.12';
3 16     16   189 use strict;
  16         37  
  16         882  
4 16     16   100 use warnings;
  16         35  
  16         543  
5              
6 16     16   96 use Moose;
  16         42  
  16         136  
7 16     16   127593 use MooseX::StrictConstructor;
  16         74  
  16         166  
8 16     16   60690 use Chart::OFC::Types;
  16         43  
  16         3091  
9              
10             extends 'Chart::OFC::Dataset::Line';
11              
12             has values =>
13             ( is => 'ro',
14             isa => 'Chart::OFC::Type::NonEmptyArrayRefOfArrayRefsOfNumsOrUndefs',
15             required => 1,
16             auto_deref => 1,
17             );
18              
19             has circle_size =>
20             ( is => 'ro',
21             isa => 'Chart::OFC::Type::PosInt',
22             default => 5,
23             );
24              
25             sub type
26             {
27 4     4 0 12 return 'scatter';
28             }
29              
30             sub _parameters_for_type
31             {
32 4     4   9 my $self = shift;
33              
34 4         168 my @p = ( $self->width(), $self->color() );
35              
36 4 100       180 push @p, ( $self->label(), $self->text_size(), $self->circle_size() )
37             if $self->_has_label();
38              
39 4         33 return @p;
40             }
41              
42 16     16   107 no Moose;
  16         37  
  16         102  
43              
44             __PACKAGE__->meta()->make_immutable();
45              
46             1;
47              
48             # ABSTRACT: A dataset represented as a scatter plot point for each value
49              
50             __END__
51              
52             =pod
53              
54             =head1 NAME
55              
56             Chart::OFC::Dataset::Scatter - A dataset represented as a scatter plot point for each value
57              
58             =head1 VERSION
59              
60             version 0.12
61              
62             =head1 SYNOPSIS
63              
64             my @numbers = ( [ 1, 2, 3 ], [ 3, 2, 1 ] );
65             my $scatter = Chart::OFC::Dataset::Scatter->new(
66             values => \@numbers,
67             width => 5,
68             color => 'purple',
69             label => 'Daily Sales in $',
70             text_size => 12,
71             circle_size => 10,
72             );
73              
74             =head1 DESCRIPTION
75              
76             This class contains values to be charted as scatter points on a grid chart.
77              
78             =for Pod::Coverage type
79              
80             =head1 ATTRIBUTES
81              
82             This class has several attributes which may be passed to the C<new()>
83             method.
84              
85             It is a subclass of C<Chart::OFC::Dataset::Line> and accepts all of
86             that class's attributes as well as its own.
87              
88             =head2 values
89              
90             This dataset accepts an arrayref which in turn contains one or more
91             array references, each of which contains a set of values.
92              
93             =head2 circle_size
94              
95             This is included for compatibility with OFC, but does not seem to effect
96             the chart.
97              
98             Defaults to 5.
99              
100             =head1 ROLES
101              
102             This class does the C<Chart::OFC::Role::OFCDataLines> role.
103              
104             =head1 AUTHOR
105              
106             Dave Rolsky <autarch@urth.org>
107              
108             =head1 COPYRIGHT AND LICENSE
109              
110             This software is Copyright (c) 2014 by Dave Rolsky.
111              
112             This is free software, licensed under:
113              
114             The Artistic License 2.0 (GPL Compatible)
115              
116             =cut