Chart::Clicker::Data::Series::HighLow - Series data with additional attributes for High-Low charts


Chart-Clicker documentation Contained in the Chart-Clicker distribution.

Index


Code Index:

NAME

Top

Chart::Clicker::Data::Series::HighLow - Series data with additional attributes for High-Low charts

DESCRIPTION

Top

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

SYNOPSIS

Top

  use Chart::Clicker::Data::Series::HighLow;

  my $series = Chart::Clicker::Data::Series::HighLow->new({
    keys    => \@keys,
    values  => \@values,
    highs   => \@highs,
    lows    => \@lows,
    opens   => \@opens
  });

ATTRIBUTES

Top

highs

Set/Get the highs for this series.

lows

Set/Get the lows for this series.

opens

Set/Get the opens for this series.

METHODS

Top

new

Creates a new, empty Series::Size

add_to_highs

Adds a high to this series.

add_to_lows

Adds a high to this series.

add_to_opens

Adds an open to this series.

get_high

Get a high by it's index.

get_low

Get a low by it's index.

get_open

Get an open by it's index.

high_count

Gets the count of sizes in this series.

low_count

Gets the count of lows in this series.

open_count

Gets the count of opens in this series.

AUTHOR

Top

Cory G Watson <gphat@cpan.org>

LICENSE

Top

You can redistribute and/or modify this code under the same terms as Perl itself.

1;


Chart-Clicker documentation Contained in the Chart-Clicker distribution.

package Chart::Clicker::Data::Series::HighLow;
use Moose;

extends 'Chart::Clicker::Data::Series';

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__