NAME
Hypatia::Base - An Abstract Base Class
VERSION
version 0.027
ATTRIBUTES
dbi
If the data source is from DBI, then this attribute contains the information necessary to connect to the database (dsn
,username
, and password
) along with the source of the data within the database (query
or table
). This hash reference is passed directly into a Hypatia::DBI object. Note that if a connection is successful, the resulting database handle is passed into a dbh
attribute. See Hypatia::DBI for more information.
columns
This is a hash reference whose keys represent the column types (often x
and y
) and the values of which represent column names from the data that correspond to the given column type.
input_data
If your data source isn't from a database, then you can store your own data in this attribute. The requirements will vary depending on subclass.
columns
This is a hash reference that assigns a sub-class dependent column type (e.g. x
or y
) to one or more columns. For example,
columns=>{
x=>"time_of_day",
y=>"num_widget_sales"
}
could be used in a line graph to indicate that the "time_of_day" column goes on the x-axis and the "num_widget_sales" column goes on the y-axis. On the other hand, for a bubble chart, you might have
columns=>{
x=>"total_units_sold",
y=>["pct_growth_over_last_year","pct_growth_over_last_month"],
size=>["pct_yearly_revenue","pct_monthly_revenue"]
}
to indicate a bubble chart with two sets of y values each having two different columns to indicate size, and all with a single set of x values.
Note: The exact requirements of this attribute will vary depending on which sub-class you're calling. Consult the relevant documentation.
INTERNAL METHODS
_guess_columns
This can be thought of as a (quasi) abstract method. By default, this method simply invokes a confession, but it's meant to be overridden by submodules.
_get_data
This method is responsible for returning the data required by the graph
methods (as provided by modules extending this module). If the columns
attribute isn't set, then column guessing is triggered (via the _guess_columns
method). If the data source is from a database connection, then this method grabs it, otherwise it returns the data from the input_data
attribute.
AUTHOR
Jack Maney <jack@jackmaney.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Jack Maney.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.