File Coverage

blib/lib/Chart/Clicker/Data/Series/HighLow.pm
Criterion Covered Total %
statement 13 13 100.0
branch n/a
condition n/a
subroutine 4 4 100.0
pod n/a
total 17 17 100.0


line stmt bran cond sub pod time code
1             package Chart::Clicker::Data::Series::HighLow;
2             $Chart::Clicker::Data::Series::HighLow::VERSION = '2.88';
3 1     1   28678 use Moose;
  1         544542  
  1         7  
4              
5             extends 'Chart::Clicker::Data::Series';
6              
7             # ABSTRACT: Series data with additional attributes for High-Low charts
8              
9 1     1   7005 use List::Util qw(max min);
  1         2  
  1         313  
10              
11              
12             sub _build_range {
13 1     1   2 my ($self) = @_;
14              
15 1         127 return Chart::Clicker::Data::Range->new(
16 1         193 lower => min(@{ $self->lows }),
17 1         4 upper => max(@{ $self->highs })
18             );
19             }
20              
21              
22             has 'highs' => (
23             traits => [ 'Array' ],
24             is => 'rw',
25             isa => 'ArrayRef',
26             default => sub { [] },
27             handles => {
28             'add_to_highs' => 'push',
29             'high_count' => 'count',
30             'get_high' => 'get'
31             }
32             );
33              
34              
35             has 'lows' => (
36             traits => [ 'Array' ],
37             is => 'rw',
38             isa => 'ArrayRef',
39             default => sub { [] },
40             handles => {
41             'add_to_lows' => 'push',
42             'low_count' => 'count',
43             'get_low' => 'get'
44             }
45             );
46              
47              
48             has 'opens' => (
49             traits => [ 'Array' ],
50             is => 'rw',
51             isa => 'ArrayRef',
52             default => sub { [] },
53             handles => {
54             'add_to_opens' => 'push',
55             'open_count' => 'count',
56             'get_open' => 'get'
57             }
58             );
59              
60             __PACKAGE__->meta->make_immutable;
61              
62 1     1   6 no Moose;
  1         1  
  1         5  
63              
64             1;
65              
66             __END__
67              
68             =pod
69              
70             =head1 NAME
71              
72             Chart::Clicker::Data::Series::HighLow - Series data with additional attributes for High-Low charts
73              
74             =head1 VERSION
75              
76             version 2.88
77              
78             =head1 SYNOPSIS
79              
80             use Chart::Clicker::Data::Series::HighLow;
81              
82             my @keys = ();
83             my @values = ();
84             my @highs = ();
85             my @lows = ();
86             my @opens = ();
87              
88             my $series = Chart::Clicker::Data::Series::HighLow->new({
89             keys => \@keys,
90             values => \@values,
91             highs => \@highs,
92             lows => \@lows,
93             opens => \@opens
94             });
95              
96             =head1 DESCRIPTION
97              
98             Chart::Clicker::Data::Series::HighLow is an extension of the Series class
99             that provides storage for a three new variables called for use with the
100             CandleStick renderer. The general idea is:
101              
102             --- <-- High
103             |
104             |
105             - <-- max of Open, Value
106             | |
107             | |
108             - <-- min of Open, Value
109             |
110             |
111             --- <-- Low
112              
113             =head1 ATTRIBUTES
114              
115             =head2 highs
116              
117             Set/Get the highs for this series.
118              
119             =head2 lows
120              
121             Set/Get the lows for this series.
122              
123             =head2 opens
124              
125             Set/Get the opens for this series.
126              
127             =head1 METHODS
128              
129             =head2 add_to_highs
130              
131             Adds a high to this series.
132              
133             =head2 get_high ($index)
134              
135             Get a high by it's index.
136              
137             =head2 high_count
138              
139             Gets the count of sizes in this series.
140              
141             =head2 add_to_lows
142              
143             Adds a high to this series.
144              
145             =head2 get_low ($index)
146              
147             Get a low by it's index.
148              
149             =head2 low_count
150              
151             Gets the count of lows in this series.
152              
153             =head2 add_to_opens
154              
155             Adds an open to this series.
156              
157             =head2 get_open
158              
159             Get an open by it's index.
160              
161             =head2 open_count
162              
163             Gets the count of opens in this series.
164              
165             =head1 AUTHOR
166              
167             Cory G Watson <gphat@cpan.org>
168              
169             =head1 COPYRIGHT AND LICENSE
170              
171             This software is copyright (c) 2014 by Cold Hard Code, LLC.
172              
173             This is free software; you can redistribute it and/or modify it under
174             the same terms as the Perl 5 programming language system itself.
175              
176             =cut