File Coverage

blib/lib/Chart/OFC/Dataset/Area.pm
Criterion Covered Total %
statement 24 24 100.0
branch 4 4 100.0
condition n/a
subroutine 8 8 100.0
pod 0 1 0.0
total 36 37 97.3


line stmt bran cond sub pod time code
1             package Chart::OFC::Dataset::Area;
2             $Chart::OFC::Dataset::Area::VERSION = '0.12';
3 16     16   104 use strict;
  16         30  
  16         720  
4 16     16   100 use warnings;
  16         35  
  16         549  
5              
6 16     16   94 use Moose;
  16         35  
  16         140  
7 16     16   112147 use MooseX::StrictConstructor;
  16         42  
  16         157  
8 16     16   57304 use Chart::OFC::Types;
  16         45  
  16         3827  
9              
10             extends 'Chart::OFC::Dataset::Line';
11              
12             has dot_size =>
13             ( is => 'ro',
14             isa => 'Chart::OFC::Type::PosInt',
15             default => 5,
16             );
17              
18             has opacity =>
19             ( is => 'ro',
20             isa => 'Chart::OFC::Type::Opacity',
21             default => '80',
22             );
23              
24             has fill_color =>
25             ( is => 'ro',
26             isa => 'Chart::OFC::Type::Color',
27             coerce => 1,
28             predicate => '_has_fill_color',
29             );
30              
31             sub type
32             {
33 3     3 0 8 return 'area_hollow';
34             }
35              
36             sub _parameters_for_type
37             {
38 3     3   6 my $self = shift;
39              
40 3         126 my @p = ( $self->width(), $self->dot_size(), $self->opacity(), $self->color() );
41              
42 3 100       138 push @p, ( $self->label(), $self->text_size() )
43             if $self->_has_label();
44              
45 3 100       138 push @p, $self->fill_color()
46             if $self->_has_fill_color();
47              
48 3         27 return @p;
49             }
50              
51 16     16   106 no Moose;
  16         36  
  16         122  
52              
53             __PACKAGE__->meta()->make_immutable();
54              
55             1;
56              
57              
58             # ABSTRACT: A dataset represented as a line with a filled area
59              
60             __END__
61              
62             =pod
63              
64             =head1 NAME
65              
66             Chart::OFC::Dataset::Area - A dataset represented as a line with a filled area
67              
68             =head1 VERSION
69              
70             version 0.12
71              
72             =head1 SYNOPSIS
73              
74             my @numbers = (1, 2, 3);
75             my $bars = Chart::OFC::Dataset::Area->new(
76             values => \@numbers,
77             dot_size => 3,
78             opacity => 60,
79             color => 'blue',
80             fill_color => 'purple',
81             label => 'Daily Sales in $',
82             text_size => 12,
83             );
84              
85             =head1 DESCRIPTION
86              
87             This class contains values to be charted as a dotted line with a
88             filled area between the line and the X axis.
89              
90             =for Pod::Coverage type
91              
92             =head1 ATTRIBUTES
93              
94             This class has several attributes which may be passed to the C<new()>
95             method.
96              
97             It is a subclass of C<Chart::OFC::Dataset::Line> and accepts all of
98             that class's attributes as well as its own.
99              
100             =head2 opacity
101              
102             This defines how opaque the bars are. When they are moused over, they
103             become fully opaque.
104              
105             Defaults to 80 (percent).
106              
107             =head2 fill_color
108              
109             The color used to fill the area between the line and the X axis.
110              
111             This attribute is optional. If it is not provided, then OFC uses the
112             color of the line itself (set with the C<color> attribute).
113              
114             =head2 dot_size
115              
116             The size of the dots in pixels.
117              
118             Defaults to 5.
119              
120             =head1 ROLES
121              
122             This class does the C<Chart::OFC::Role::OFCDataLines> role.
123              
124             =head1 AUTHOR
125              
126             Dave Rolsky <autarch@urth.org>
127              
128             =head1 COPYRIGHT AND LICENSE
129              
130             This software is Copyright (c) 2014 by Dave Rolsky.
131              
132             This is free software, licensed under:
133              
134             The Artistic License 2.0 (GPL Compatible)
135              
136             =cut