NAME

Text::Graph::Data - Encapsulate data for Text::Graph

VERSION

This document describes "Text::Graph::Data" version 0.82.

SYNOPSIS

  use Text::Graph::Data;

  my $gdat = Text::Graph::Data->new( \@values, \@labels );

DESCRIPTION

Encapsulate the description of the data used by the Text::Graph object.

The Text::Graph object needs data values and labels for each data value to generate appropriate graphs. The Text::Graph::Data object allows several methods of constructing this data and provides a simple interface for retrieving it.

METHODS

new

The new method creates a Text::Graph::Data object. The new method can create this object from several different kinds of input.

If the first parameter is a single array reference, this becomes the values for the Text::Graph::Data object. If the first and second parameters are array references, they become the values and labels for the Text::Graph::Data object, respectively.

If the first parameter is a hash reference, it is used to construct the value and labels for the Text::Graph::Data object. If there are no other parameters, the keys of the hash will be sorted ASCIIbetically to generate the labels, and the values will be the corresponding values from the hash. If the second parameter is an array reference, it will be used as the labels for the the Text::Graph::Data object, and the values will be the corresponding values from the hash.

After the above parameters are taken care of, or if they did not exist, any remaining parameters are used to customize the data set. Those parameters are taken as name/value pairs to set various options on the object. The defined options are

values

A reference to an array of values to use for this data set.

labels

A reference to an array of labels to use for this data set.

hash

A reference to a hash containing the values and labels for this data set.

sort

A reference to a subroutine that takes the list of labels and sorts them into the appropriate order. The default value is an ASCIIbetical sort.

get_values

In scalar context, get_values returns a reference to the array containing the values in this data set. In list context, it returns the values as a list.

get_labels

In scalar context, get_labels returns a reference to the array containing the labels in this data set. In list context, it returns the labels as a list.

AUTHOR

G. Wade Johnson, gwadej@cpan.org

COPYRIGHT

Copyright 2004-2014 G. Wade Johnson

This module is free software; you can distribute it and/or modify it under the same terms as Perl itself.

perl(1).