The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

Chart::Clicker::Drawing::ColorAllocator

DESCRIPTION

Allocates colors for use in the chart. The position in the color allocator corresponds to the series that will be colored.

SYNOPSIS

    use Chart::Clicker::Drawing::ColorAllocator;

    my $ca = new Chart::Clicker::Drawing::ColorAllocator({
        colors => (
            new Chart::Clicker::Drawing::Color(1.0, 0, 0, 1.0),
            ...
        )
    });

    my $red = $ca->get(0);

METHODS

Constructor

new({ colors => \@colors })

Create a new ColorAllocator. You can optionally pass an arrayref of colors to 'seed' the allocator.

Class Methods

$pos = $ca->position();

Gets the current position.

$color = $ca->next();

Returns the next color.

$ca->reset()

Resets this allocator back to the beginning.

$color = $ca->get($count)

Gets the color at the specified index. Returns undef if that position has no color.

AUTHOR

Cory 'G' Watson <gphat@onemogin.com>

SEE ALSO

perl(1)