Chart::OFC2::Title - OFC2 title object


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

Index


Code Index:

NAME

Top

Chart::OFC2::Title - OFC2 title object

SYNOPSIS

Top

    use Chart::OFC2;
    use Chart::OFC2::Title;

    $chart = Chart::OFC2->new(
        'title'  => 'Bar chart test',
    );

    $chart = Chart::OFC2->new(
        'title'  => Chart::OFC2::Title->new(
            'text'  => 'Bar chart test',
            'style' => '{font-size:20px; font-family:Verdana; text-align:center;}',
        ),
    );

DESCRIPTION

Top

PROPERTIES

Top

    has 'text'  => (is => 'rw', isa => 'Str', );
    has 'style' => (is => 'rw', isa => 'Str', );

METHODS

Top

new()

Object constructor.

TO_JSON()

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

AUTHOR

Top

Jozef Kutej


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

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

our $VERSION = '0.07';

coerce 'Chart::OFC2::Title'
    => from 'Str'
    => via { Chart::OFC2::Title->new('text' => $_) };

has 'text'  => (is => 'rw', isa => 'Str', );
has 'style' => (is => 'rw', isa => 'Str', );


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

__PACKAGE__->meta->make_immutable;

1;


__END__