Chart::OFC2::Labels - OFC2 labels object


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

Index


Code Index:

NAME

Top

Chart::OFC2::Labels - OFC2 labels object

SYNOPSIS

Top

    use Chart::OFC2::Labels;

    'x_axis' => Chart::OFC2::XAxis->new(
        labels => { 
            labels => [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun' ]
        }
    ),

    'x_axis' => Chart::OFC2::XAxis->new(
        labels => {
            labels => [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun' ],
            colour => '#555555',
            rotate => 45
        }
    ),

DESCRIPTION

Top

PROPERTIES

Top

    has 'labels' => ( is => 'rw', isa => 'ArrayRef', );
    has 'colour' => ( is => 'rw', isa => 'Str', alias => 'color' );
    has 'rotate' => ( is => 'rw', isa => 'Num', );

METHODS

Top

new()

Object constructor.

TO_JSON()

Returns HashRef that is possible to give to encode_json() function.

color()

Same as colour().

AUTHOR

Top

Jozef Kutej


Chart-OFC2 documentation Contained in the Chart-OFC2 distribution.
package Chart::OFC2::Labels;

use Moose;
use Moose::Util::TypeConstraints;
use MooseX::StrictConstructor;
use MooseX::Aliases;

our $VERSION = '0.07';

has 'labels' => ( is => 'rw', isa => 'ArrayRef', );
has 'colour' => ( is => 'rw', isa => 'Str', alias => 'color' );
has 'rotate' => ( is => 'rw', isa => 'Num', );


sub TO_JSON {
    my ($self) = @_;
    
    return {
        map  { my $v = $self->$_; (defined $v ? ($_ => $v) : ()) }
        map  { $_->name } $self->meta->get_all_attributes
    };
}

sub color {
    &colour;
}

__PACKAGE__->meta->make_immutable;

1;


__END__