Hypatia - A Data Visualization API
version 0.029
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");
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).
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!).
DBIx::*
Chartx::Clicker
Chart::Clickerx
Chart::xClicker
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
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.
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.
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.
Chart::Clicker
This string attribute represents the type of graph that you want:
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).
Jack Maney <jack@jackmaney.com>
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.
To install Hypatia, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Hypatia
CPAN shell
perl -MCPAN -e shell install Hypatia
For more information on module installation, please visit the detailed CPAN module installation guide.