0.0
No commit activity in last 3 years
No release in over 3 years
Gem that creates a google visualization data source from hashes passed to it.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

Rubualizations¶ ↑

Summary

Rubualizations is a ruby gem which converts ruby hashes into data structures which can be used by (Google Visualizations) to create graphs in your web page.

At present it a partial implementation of the (data source specification described here) which I hope will evolve to cover the complete specification.

Usage

Include the module

include Rubualizations::Rails::Tableable

In the class definition would you would like to use the module

Define the columns to use by setting the @cols_def (column definition) attribute in the class where you will be converting your hashes (or in the initialize method)

@cols_def = { 
   "dateplaced" => {id: "A", label: "Date Placed", type: "datetime"}
   "profit" => {id: "B", label: "Profit", type: "number"}
}

According to the google visualization API specification (see examples here)

Then pass the tablize_hashes method a list of hashes which include the attributes defined in the your column definition. In our example this is ‘dateplaced’ and ‘profit’ and return the definitions.

tablize(hash_list, {cols:"dataplaced,profit"})

If you expose the output of this method to the web you can query your data using the query string

?cols=dateplaced,profit

Also see github.com/whatsthebeef/rubualizations-rails for rails specific gem which handles ActiveRecords as well as hashes