| 1 | package Chart::Clicker::Data::Series::HighLow; | ||
| 2 | 1 | $Chart::Clicker::Data::Series::HighLow::VERSION = '2.89'; | |
| 3 | 1 | ▶ | use Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 4 | |||
| 5 | 1 | extends 'Chart::Clicker::Data::Series'; | |
| 6 | |||
| 7 | # ABSTRACT: Series data with additional attributes for High-Low charts | ||
| 8 | |||
| 9 | 1 | ▶ | use List::Util qw(max min); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | |||
| 12 | sub _build_range { | ||
| 13 | 1 | ▶ | my ($self) = @_; |
|
Subroutine
_build_range: called CC=1 SCAR=0.0
| |||
| 14 | |||
| 15 | return Chart::Clicker::Data::Range->new( | ||
| 16 | 1 | lower => min(@{ $self->lows }), | |
| 17 | 1 | upper => max(@{ $self->highs }) | |
| 18 | ); | ||
| 19 | } | ||
| 20 | |||
| 21 | |||
| 22 | has 'highs' => ( | ||
| 23 | traits => [ 'Array' ], | ||
| 24 | is => 'rw', | ||
| 25 | isa => 'ArrayRef', | ||
| 26 | 1 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 27 | 1 | 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 | 1 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 40 | 1 | 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 | 1 | ▶ | default => sub { [] }, |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 53 | 1 | handles => { | |
| 54 | 'add_to_opens' => 'push', | ||
| 55 | 'open_count' => 'count', | ||
| 56 | 'get_open' => 'get' | ||
| 57 | } | ||
| 58 | ); | ||
| 59 | |||
| 60 | 1 | __PACKAGE__->meta->make_immutable; | |
| 61 | |||
| 62 | 1 | ▶ | no Moose; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 63 | |||
| 64 | 1 | 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.89 | ||
| 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) 2016 by Cory G Watson. | ||
| 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 | ||