website/index.txt in googlecharts-0.1.0 vs website/index.txt in googlecharts-0.2.0
- old
+ new
@@ -100,10 +100,16 @@
<pre syntax="ruby">
Gchart.bar(:data => [[300, 100, 30, 200], [100, 200, 300, 10]], :bar_colors => 'FF0000,00FF00')
</pre>
+If you prefer you can use this other syntax:
+
+<pre syntax="ruby">
+ Gchart.bar(:data => [[300, 100, 30, 200], [100, 200, 300, 10]], :bar_colors => ['FF0000', '00FF00'])
+</pre>
+
!http://chart.apis.google.com/chart?cht=bvs&chs=300x200&chd=s:9UGo,Uo9C&chco=FF0000,00FF00(colors)!
The problem now, is that we can't see the first value of the second dataset since it's lower than the first value of the first dataset. Let's unstack the bars:
<pre syntax="ruby">
@@ -244,11 +250,11 @@
!http://chart.apis.google.com/chart?cht=bvg&chdl=Matt's+Mojo|Rob's+Mojo&chs=400x200&chd=s:9UGo,Uo9C&chco=FF0000,00FF00&chtt=Matt+vs+Rob(legend)!
<pre syntax="ruby">
Gchart.line( :title => "Matt vs Rob",
:data => [[300, 100, 30, 200], [100, 200, 300, 10]],
- :bar_colors => 'FF0000,00FF00',
+ :bar_colors => ['FF0000','00FF00'],
:stacked => false, :size => '400x200',
:legend => ["Matt's Mojo", "Rob's Mojo"] )
</pre>
!http://chart.apis.google.com/chart?cht=lc&chdl=Matt's+Mojo|Rob's+Mojo&chs=400x200&chd=s:9UGo,Uo9C&chco=FF0000,00FF00&chtt=Matt+vs+Rob(line legend)!
@@ -264,26 +270,46 @@
<pre syntax="ruby">
Gchart.line( :data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x,y,r')
</pre>
+or you can use the other syntax:
+
+<pre syntax="ruby">
+ Gchart.line( :data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => ['x','y','r'])
+</pre>
+
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chxt=x,y,r&chd=s:9UGoUo9C(axis with labels)!
<pre syntax="ruby">
Gchart.line( :data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x',
:axis_labels => ['Jan|July|Jan|July|Jan'])
</pre>
+or you can use the other syntax:
+
+<pre syntax="ruby">
+ Gchart.line( :data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x',
+ :axis_labels => ['Jan','July','Jan','July','Jan'])
+</pre>
+
!http://chart.apis.google.com/chart?cht=lc&chxl=0:|Jan|July|Jan|July|Jan&chs=300x200&chxt=x&chd=s:9UGoUo9C(x labels)!
*multiple axis labels*
<pre syntax="ruby">
Gchart.line( :data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x,r',
:axis_labels => ['Jan|July|Jan|July|Jan', '2005|2006|2007'])
</pre>
+or
+
+<pre syntax="ruby">
+ Gchart.line( :data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x,r',
+ :axis_labels => [['Jan','July','Jan','July','Jan'], ['2005','2006','2007']])
+</pre>
+
!http://chart.apis.google.com/chart?cht=lc&chxl=0:|Jan|July|Jan|July|Jan|1:|2005|2006|2007&chs=300x200&chxt=x,r&chd=s:9UGoUo9C(multiple axis labels)!
(This syntax will probably be improved in the future)
*custom params*
@@ -296,10 +322,36 @@
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:93zyvneTTOMJMLIJFHEAECFJGHDBFCFIERcgnpy45879,IJKNUWUWYdnswz047977315533zy1246872tnkgcaZQONHCECAAAAEII&chls=3,6,3|1,1,0(Custom)!
---
+*Save the chart as a file*
+
+You might prefer to save the chart instead of using the url, not a problem:
+
+<pre syntax="ruby">
+ Gchart.line(:data => [0, 26], :format => 'file')
+</pre>
+
+You might want to specify the path and/or the filename used to save your chart:
+
+<pre syntax="ruby">
+ Gchart.line(:data => [0, 26], :format => 'file', :filename => 'custom_filename.png')
+</pre>
+
+*Insert as an image tag*
+
+Because, I'm lazy, I also added a custom format:
+
+<pre syntax="ruby">
+ Gchart.line(:data => [0, 26], :format => 'img_tag')
+</pre>
+
+<img src='http://chart.apis.google.com/chart?chs=300x200&chd=s:A9&cht=lc'/>
+
+---
+
*Encoding*
Google Chart API offers "3 types of data encoding":http://code.google.com/apis/chart/#chart_data
* simple
@@ -333,10 +385,10 @@
<pre syntax="ruby">
Gchart.line( :data => [300, 100, 30, 200, 100, 200, 300, 10] )
</pre>
-!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:9UGoUo9C(Title)
+!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:9UGoUo9C(Title)!
<pre syntax="ruby">
Gchart.line( :data => [300, 100, 30, 200, 100, 200, 300, 10], :max_value => 500 )
</pre>