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