Chart::OFC::Dataset - A set of values to be charted


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

Index


Code Index:

NAME

Top

Chart::OFC::Dataset - A set of values to be charted

VERSION

Top

version 0.10

SYNOPSIS

Top

  my $dataset = Chart::OFC::Dataset->new( values => \@numbers );

DESCRIPTION

Top

This class represents a set of values that will be charted along the X axis of a chart (or as pie slices).

ATTRIBUTES

Top

This class has one attribute which may be passed to the new() method.

values

This should be an array reference containing one more numbers representing values to be plotted on the chart. On grid charts, these are plotted on the X axis.

This attribute is required, and must contain at least one value.

ROLES

Top

This class does the Chart::OFC::Role::OFCDataLines role.

AUTHOR

Top

Dave Rolsky <autarch@urth.org>

COPYRIGHT AND LICENSE

Top


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

package Chart::OFC::Dataset;
BEGIN {
  $Chart::OFC::Dataset::VERSION = '0.10';
}

use strict;
use warnings;

use Moose;
use MooseX::StrictConstructor;
use Chart::OFC::Types;

with 'Chart::OFC::Role::OFCDataLines';

has 'values' =>
    ( is         => 'ro',
      isa        => 'Chart::OFC::Type::NonEmptyArrayRefOfNums',
      required   => 1,
      auto_deref => 1,
    );

has 'links' =>
    ( is         => 'ro',
      isa        => 'Chart::OFC::Type::NonEmptyArrayRef',
      required   => 0,
      auto_deref => 1,
      predicate  => 'has_links',
    );

sub _ofc_data_lines
{
    my $self  = shift;
    my $count = shift;

    my @lines;
    if ( $self->can('type') )
    {
        my $name = $self->type();
        $name .= q{_} . $count
            if $count && $count > 1;

        push @lines,
            $self->_data_line( $name, $self->_parameters_for_type() );
    }

    my $val_name = 'values';
    $val_name .= q{_} . $count
        if $count && $count > 1;

    push @lines,
        $self->_data_line( $val_name, $self->values() );

    if ( $self->has_links() )
    {
        my $links_name = 'links';
        $links_name .= q{_} . $count
            if $count && $count > 1;

        push @lines, $self->_data_line( $links_name, $self->links() );
    }

    return @lines;
}

no Moose;

__PACKAGE__->meta()->make_immutable();

1;


# ABSTRACT: A set of values to be charted




__END__