Chart::Clicker::Decoration::Plot - Area on which renderers draw


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

Index


Code Index:

NAME

Top

Chart::Clicker::Decoration::Plot - Area on which renderers draw

DESCRIPTION

Top

A Component that handles the rendering of data via Renderers. Also handles rendering the markers that come from the Clicker object.

SYNOPSIS

Top

ATTRIBUTES

Top

background_color

Set/Get this Plot's background color.

border

Set/Get this Plot's border.

clicker

Set/Get this Plot's clicker instance.

markers

Set/Get the flag that determines if markers are drawn on this plot.

METHODS

Top

new

Creates a new Plot object.

draw

Draw this Plot

grid

Set/Get the Grid component used on this plot.

layout

Set/Get this Plot's layout. See Layout::Manager.

prepare

Prepare this Plot by determining how much space it needs.

AUTHOR

Top

Cory G Watson <gphat@cpan.org>

SEE ALSO

Top

perl(1)

LICENSE

Top

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


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

package Chart::Clicker::Decoration::Plot;
use Moose;

use Layout::Manager::Axis;
use Layout::Manager::Single;

use Chart::Clicker::Decoration::Grid;

# TODO READD THIS
#use Chart::Clicker::Decoration::MarkerOverlay;

# TODO MOve this class?  It's not decoration anymore.
extends 'Chart::Clicker::Container';

has 'clicker' => (
    is => 'rw',
    isa => 'Chart::Clicker',
);
has 'grid' => (
    is => 'rw',
    isa => 'Chart::Clicker::Decoration::Grid',
    default => sub {
        Chart::Clicker::Decoration::Grid->new( name => 'grid' )
    }
);
has '+layout_manager' => (
    default => sub { Layout::Manager::Axis->new }
);
has 'render_area' => (
    is => 'rw',
    isa => 'Chart::Clicker::Container',
    default => sub {
        Chart::Clicker::Container->new(
            name => 'render_area',
            layout_manager => Layout::Manager::Single->new
        )
    }
);

override('prepare', sub {
    my ($self) = @_;

    # TODO This is also happening in Clicker.pm
    foreach my $c (@{ $self->components }) {
        $c->clicker($self->clicker);
    }

    # TODO This is kinda messy...
    foreach my $c (@{ $self->render_area->components }) {
        $c->clicker($self->clicker);
    }

    super;
});

__PACKAGE__->meta->make_immutable;

no Moose;

1;
__END__