| Chart-OFC documentation | Contained in the Chart-OFC distribution. |
Chart::OFC::Dataset::Line - A dataset represented as a line
version 0.10
my $line = Chart::OFC::Dataset::Line->new( values => \@numbers,
width => 5,
color => 'purple',
label => 'Daily Sales in $',
text_size => 12,
);
This class contains values to be charted as a line on a grid chart.
This class has several attributes which may be passed to the new()
method.
It is a subclass of Chart::OFC::Dataset and accepts all of that
class's attributes as well as its own.
For this class, the values array may contain some undefined values. These are simply skipped in the resulting chart.
Just as with values, this may contain some undefined values.
The width of the line in pixels.
Defaults to 2.
The color of the line, and of the text in the chart key, if a label is specified.
Defaults to #999999 (medium grey).
If provided, this will be shown as part of the chart key.
This attribute is optional.
This is the size of the text in the key.
Defaults to 10 (pixels).
This class does the Chart::OFC::Role::OFCDataLines role.
Dave Rolsky <autarch@urth.org>
This software is Copyright (c) 2011 by Dave Rolsky.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)
| Chart-OFC documentation | Contained in the Chart-OFC distribution. |
package Chart::OFC::Dataset::Line; BEGIN { $Chart::OFC::Dataset::Line::VERSION = '0.10'; } use strict; use warnings; use Moose; use MooseX::StrictConstructor; use Chart::OFC::Types; extends 'Chart::OFC::Dataset'; # Cannot do has '+values' because the new type is not a subtype of the # type in the parent class. has 'values' => ( is => 'ro', isa => 'Chart::OFC::Type::NonEmptyArrayRefOfNumsOrUndefs', required => 1, auto_deref => 1, ); has width => ( is => 'ro', isa => 'Chart::OFC::Type::PosInt', default => 2, ); has color => ( is => 'ro', isa => 'Chart::OFC::Type::Color', coerce => 1, default => '#000000', ); has label => ( is => 'ro', isa => 'Str', predicate => '_has_label', ); has text_size => ( is => 'ro', isa => 'Chart::OFC::Type::Size', default => 10, ); sub type { return 'line'; } sub _parameters_for_type { my $self = shift; my @p = ( $self->width(), $self->color() ); push @p, ( $self->label(), $self->text_size() ) if $self->_has_label(); return @p; } no Moose; __PACKAGE__->meta()->make_immutable(); 1; # ABSTRACT: A dataset represented as a line
__END__