/Chartr

Ruby Plugin for Google Charts

MIT LicenseMIT

Chartr
=======

The chartr plugin helps you create charts using the google chart API.

You can make 
   - line charts with a single line 
   - line charts with multiple lines
   - stacked bar charts



Line charts:
============

The Google Chart API requires arguments that look roughly like this:

for size: chs=200x125
values :  chd=s:4gsGr6a0
chart type:  cht=lc
label types: chxt=x,y
labels: chxl=0:|Mar|Apr|May|June|July|1:||50+Kb

The plugin helps generate these values and format them correctly.


Colors for graphs with multiple lines alternate between 
['FF0000', '00FF00', '0000FF', '000000', 'EAD5FC', 'FECF3D', '8F8F94', 'FFFF00', '00FFFF', '3F3F3F', 'D0D0D0']
and a legend labels array is also required.


Bar Chart
=========

You can also supply colors.
Args:


  value_sets, 
  labels, 
  legend_labels, 
  title, 
  size="200x100", 
  max_y = nil, 
  colors = nil



Examples
========

Chartr.make_simple_line_chart [7,5,4,3,3,2,4], 
	                          ['mon','tue','wed','thu','fri','sat','sun'],
	                          'cups of coffee per day', 
	                          '200x100'%>


Chartr.make_multiple_line_chart [[7,5,4,3,3,2,4], [1,2,0,1,3,1]]
		                      ['mon','tue','wed','thu','fri','sat','sun'],
							  ['coffee', 'wine'],
							  'cups of stuff per day', 
							  '200x100'%>
							
							
Chartr.make_stacked_bar_chart(
							   [[8,8,8,8,8,16,16],[8,8,8,8,8,0,1],[8,8,8,8,8,8,7]],
							   day_labels(beginning_of_hour, 28), 
							   ['good', 'bad', "forgot"],
							   'Daily Good Hours Total', 
							   '840x200',
							    24, 
							    ['00FF00', 'FF0000', '0000FF'])
														


Copyright (c) 2008 [Daniel Wiesmann], released under the MIT license