NAME
Hypatia - A Data Visualization API
VERSION
version 0.027
SYNOPSIS
use strict;
use warnings;
use Hypatia;
my $hypatia=Hypatia->new({
back_end=>"Chart::Clicker",
graph_type=>"Line",
dbi=>{
dsn=>"dbi:MySQL:dbname=database;host=localhost",
username=>"jdoe",
password=>"sooperseekrit",
query=>"select DATE(time_of_sale) as date,sum(revenue) as daily_revenue
from widget_sales
group by DATE(time_of_sale)"
},
columns=>{"x"=>"date","y"=>"daily_revenue"}
});
#grabs data from the query and puts it into a Chart::Clicker line graph
my $cc=$hypatia->chart;
#Since $cc is a Chart::Clicker object, we can now do whatever we want to it.
$cc->title->text("Total Daily Revenue for Widget Sales");
$cc->write_output("daily_revenue.png");
DESCRIPTION
For reporting and analysis of data, it's often useful to have charts and graphs of various kinds: line graphs, bar charts, histograms, etc. Of course, CPAN has modules for data visualization--in fact, there are quite a few of them, each with different features and wildly different syntaxes. The aim of Hypatia is to provide a layer between DBI and these data visualization modules, so that one can get a basic, "no-frills" chart with as little knowledge of the syntax of the particular data visualization package as possible.
Currently, the only bindings that are supported are:
However, support for other data visualization modules will be supported (see the "TODO" section below).
Hypatia?
This distribution makes use of DBI, but isn't an extension of DBI, and hence doesn't belong in the DBIx::*
namespace. It also isn't an extension of, eg, Chart::Clicker, and thus shouldn't be in the Chartx::Clicker
namespace (or should that be Chart::Clickerx
? Chart::xClicker
? Bah!).
So, instead, this distribution is named after the first female mathematician of historical note and a mathematician and one of the librarians of the Great Library of Alexandria
WARNING
Although I've put a considerable amount of thought into the API, this software should considered to be in alpha status. The API may change, although if it does, I'll do what I can to preserve backwards compatibility.
TODO
Expand the API to other data visualization packages.
Add unit tests and more attributes to Hypatia::GraphViz2.
Allow the loading of options via configuration files (initially XML or ini; the only thing making this difficult for JSON is that queries usually take more than one line, and JSON doesn't support multi-line strings).
Finish up some more of the options in Hypatia::Chart::Clicker, and include some default "prettification" options that adds a reasonable amount of padding, fudging, etc.
ATTRIBUTES
back_end
This string attribute represents the general name of the data visualization API that you wish to use. For right now, the only supported value is Chart::Clicker
.
graph_type
This string attribute represents the type of graph that you want:
ACKNOWLEDGEMENTS
I'd like to thank the following people for suggestions in making this distribution better. Any (constructive) criticism and feedback is welcome (jack at jackmaney dot com or jackmaney at gmail dot com).
- 1. Cory Watson (aka gphat) for suggestions that greatly streamlined the API.
- 2. David Precious for the idea of passing an active database handle into a Hypatia::DBI object, instead of requiring the connection parameters.
- 3. Ron Savage for updating GraphViz2 in order to make unit tests easier.
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.