website/index.txt in googlecharts-0.0.2 vs website/index.txt in googlecharts-0.0.3

- old
+ new

@@ -1,39 +1,169 @@ -h1. gchart +h1. Googlecharts -h1. &#x2192; 'gchart' +h2. &#x2192; 'Sexy Charts using Google API & Ruby' h2. What + + A nice and simple wrapper for "Google Chart API":http://code.google.com/apis/chart/ - h2. Installing -<pre syntax="ruby">sudo gem install gchart</pre> +<pre syntax="ruby">sudo gem install googlecharts</pre> h2. The basics +This gem supports the following types of charts: + +!http://chart.apis.google.com/chart?cht=lc&chs=200x125&chd=s:helloWorld&chxt=x,y&chxl=0:|Mar|Apr|May|June|July|1:||50+Kb(Line)! Gchart.line() +!http://chart.apis.google.com/chart?cht=lxy&chs=200x125&chd=t:0,30,60,70,90,95,100|20,30,40,50,60,70,80|10,30,40,45,52|100,90,40,20,10|-1|5,33,50,55,7&chco=3072F3,ff0000,00aaaa&chls=2,4,1&chm=s,FF0000,0,-1,5|s,0000ff,1,-1,5|s,00aa00,2,-1,5(line_xy)! Gchart.line_xy() + +!http://chart.apis.google.com/chart?cht=s&chd=s:984sttvuvkQIBLKNCAIi,DEJPgq0uov17zwopQODS,AFLPTXaflptx159gsDrn&chxt=x,y&chxl=0:|0|2|3|4|5|6|7|8|9|10|1:|0|25|50|75|100&chs=200x125(scatter)! Gchart.scatter() + +!http://chart.apis.google.com/chart?cht=bvg&chs=200x125&chd=s:hello,world&chco=cc0000,00aa00(bar)! Gchart.bar() + +!http://chart.apis.google.com/chart?cht=v&chs=200x100&chd=t:100,80,60,30,30,30,10(venn)! Gchart.venn() + +!http://chart.apis.google.com/chart?cht=p&chd=s:world5&chs=200x125&chl=A|B|C|D|E|Fe(pie)! Gchart.pie() + +!http://chart.apis.google.com/chart?cht=p3&chd=s:Uf9a&chs=200x100&chl=A|B|C|D(pie_3d)! Gchart.pie_3d() + + h2. Demonstration of usage +install: +<code>sudo gem install googlecharts</code> +require: +<pre syntax="ruby">require 'gchart'</pre> -h2. Forum +<pre syntax="ruby">Gchart.line( :size => '200x300', + :title => "example title", + :bg => 'efefef', + :legend => ['first data set label', 'second data set label'], + :data => [10, 30, 120, 45, 72])</pre> -"http://groups.google.com/group/gchart":http://groups.google.com/group/gchart +--- -TODO - create Google Group - gchart +*simple line chart* +<pre syntax"ruby"> + Gchart.line(:data => [0, 40, 10, 70, 20]) +</pre> -h2. How to submit patches +Generate the following url: http://chart.apis.google.com/chart?chs=300x200&chd=s:AiI9R&cht=lc -Read the "8 steps for fixing other people's code":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/ and for section "8b: Submit patch to Google Groups":http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups, use the Google Group above. +Inserted in an image tag, it will look like that: -The trunk repository is <code>svn://rubyforge.org/var/svn/gchart/trunk</code> for anonymous access. +!http://chart.apis.google.com/chart?chs=300x200&chd=s:AiI9R&cht=lc(simple line chart)! +*multiple line charts* +<pre syntax"ruby"> + Gchart.line(:data => [[0, 40, 10, 70, 20],[41, 10, 80, 50]]) +</pre> + +!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:AeH1P,fH9m(multiple lines chart)! + +*set line colors* + +<pre syntax"ruby"> + Gchart.line(:data => [[0, 40, 10, 70, 20],[41, 10, 80, 50]], :line_colors => "FF0000,00FF00") +</pre> + +!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:AeH1P,fH9m&chco=FF0000,00FF00(line colors)! + +"more info about color settings":http://code.google.com/apis/chart/#chart_colors + +*bar chart* + +<pre syntax"ruby"> + Gchart.bar(:data => [300, 100, 30, 200]) +</pre> +!http://chart.apis.google.com/chart?cht=bvs&chs=300x200&chd=s:9UGo(bars)! + +*Set the bar chart orientation* + +<pre syntax"ruby"> + Gchart.bar(:data => [300, 100, 30, 200], :orientation => 'horizontal') +</pre> +!http://chart.apis.google.com/chart?cht=bhs&chs=300x200&chd=s:9UGo(bars)! + + +*pie chart* + +<pre syntax"ruby"> + Gchart.pie(:data => [20, 35, 45]) +</pre> +!http://chart.apis.google.com/chart?cht=p&chs=300x200&chd=s:bv9(Pie Chart)! + +*venn diagram* + +"Google documentation":http://code.google.com/apis/chart/#venn + +Data set: +* the first three values specify the relative sizes of three circles, A, B, and C +* the fourth value specifies the area of A intersecting B +* the fifth value specifies the area of B intersecting C +* the sixth value specifies the area of C intersecting A +* the seventh value specifies the area of A intersecting B intersecting C + +<pre syntax"ruby"> + Gchart.venn(:data => [100, 80, 60, 30, 30, 30, 10]) +</pre> +!http://chart.apis.google.com/chart?cht=v&chs=300x200&chd=s:9wkSSSG(Venn)! + +*scatter plot* + +"Google Documentation":http://code.google.com/apis/chart/#scatter_plot + +Supply two data sets, the first data set specifies x coordinates, the second set specifies y coordinates, the third set the data point size. + +<pre syntax"ruby"> + Gchart.scatter(:data => [[1, 2, 3, 4, 5], [1, 2, 3, 4 ,5], [5, 4, 3, 2, 1]]) +</pre> + +!http://chart.apis.google.com/chart?cht=s&chs=300x200&chd=s:MYkw9,MYkw9,9wkYM(scatter)! + +--- + +*set a chart title* + +<pre syntax"ruby"> + Gchart.bar(:title => "Recent Chart Sexyness", :data => [15, 30, 10, 20, 100, 20, 40, 100]) +</pre> + +!http://chart.apis.google.com/chart?cht=bvs&chs=300x200&chd=s:JSGM9MY9&chtt=Recent+Chart+Sexyness(chart title)! + +*set the image background color* + +<pre syntax"ruby"> + Gchart.bar( :title => "Matt's Mojo", + :data => [15, 30, 10, 20, 100, 20, 40, 100, 90, 100, 80], + :background => 'EEEEEE') +</pre> + +!http://chart.apis.google.com/chart?chf=bg,s,EEEEEE&cht=bvs&chs=300x200&chd=s:JSGM9MY929w&chtt=Matt's+Mojo(Background)! + +*set the chart background color* + +<pre syntax"ruby"> + Gchart.bar( :title => "Matt's Mojo", + :data => [15, 30, 10, 20, 100, 20, 40, 100, 90, 100, 80], + :background => 'EEEEEE', :chart_background => '000000') +</pre> + +!http://chart.apis.google.com/chart?chf=c,s,000000|bg,s,EEEEEE&cht=bvs&chs=300x200&chd=s:JSGM9MY929w&chtt=Matt's+Mojo(chart background)! + + +h2. Repository + +The trunk repository is <code>svn://rubyforge.org/var/svn/Gchart/trunk</code> for anonymous access. + h2. License This code is free to use under the terms of the MIT license. h2. Contact -Comments are welcome. Send an email to "Matt Aimonetti":mailto:mattaimonetti@gmail.com via the "forum":http://groups.google.com/group/gchart +Comments are welcome. Send an email to "Matt Aimonetti":mailto:mattaimonetti@gmail.com