NAME

Hypatia - A Data Visualization API

VERSION

version 0.02

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, only bindings for Chart::Clicker (via Hypatia::Chart::Clicker) is supported. 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. Hypatia::GraphViz2 will be out soon, and other bindings will follow.

  • 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).

  • For Hypatia::Chart::Clicker, include an Options object that allows for direct in-lining of Chart::Clicker options (rather than creating them via the graph method and then altering the resulting Chart::Clicker object).

  • Allow "reasonable" defaults for column names and types. For example, if we have a line graph in Chart::Clicker, and if the query only specifies two columns, then take the first column to be of type x and the second of type y. To do this properly, the query will have to be parsed. Sadly, Parse::SQL doesn't seem to correctly parse queries that contain sub-queries.

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.

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.