mattetti-googlecharts 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +11 -0
- data/README.txt +5 -176
- data/lib/gchart/version.rb +1 -1
- data/lib/gchart.rb +49 -24
- data/spec/gchart_spec.rb +42 -2
- data/website/index.txt +179 -85
- metadata +1 -1
data/History.txt
CHANGED
@@ -1,3 +1,14 @@
|
|
1
|
+
== 1.3.X
|
2
|
+
* added code to properly escape image tag URLs (mokolabs)
|
3
|
+
* added themes support + 4 default themes (keynote, thirty7signals, pastel, greyscale) chart.line(:theme=>:keynote) (jakehow)
|
4
|
+
|
5
|
+
== 1.3.4
|
6
|
+
* updated documentation and cleaned it up (mokolabs)
|
7
|
+
* added support for custom class, id and alt tags when using the image_tag format (i.e Gchart.line(:data => [0, 26], :format => 'image_tag')) (mokolabs)
|
8
|
+
|
9
|
+
== 1.3.2 - 1.3.3
|
10
|
+
* changes required by github
|
11
|
+
|
1
12
|
== 1.3.1
|
2
13
|
* added width and spacing options
|
3
14
|
|
data/README.txt
CHANGED
@@ -1,180 +1,9 @@
|
|
1
|
-
|
1
|
+
CHECK README.markdown (open as a text file)
|
2
2
|
|
3
|
-
|
4
|
-
:title => "example title",
|
5
|
-
:bg => 'efefef',
|
6
|
-
:legend => ['first data set label', 'second data set label'],
|
7
|
-
:data => [10, 30, 120, 45, 72])
|
8
|
-
|
3
|
+
Or check:
|
9
4
|
|
5
|
+
http://googlecharts.rubyforge.org
|
10
6
|
|
11
|
-
|
7
|
+
and/or
|
12
8
|
|
13
|
-
|
14
|
-
|
15
|
-
* line,
|
16
|
-
* line_xy
|
17
|
-
* sparkline
|
18
|
-
* scatter
|
19
|
-
* bar
|
20
|
-
* venn
|
21
|
-
* pie
|
22
|
-
* pie_3d
|
23
|
-
|
24
|
-
To create a chart, simply require Gchart and call any of the existing type:
|
25
|
-
|
26
|
-
require 'gchart'
|
27
|
-
Gchart.pie
|
28
|
-
|
29
|
-
|
30
|
-
==Chart Title
|
31
|
-
|
32
|
-
To add a title to a chart pass the title to your chart:
|
33
|
-
|
34
|
-
Gchart.line(:title => 'Sexy Charts!')
|
35
|
-
|
36
|
-
You can also specify the color and/or size
|
37
|
-
|
38
|
-
Gchart.line(:title => 'Sexy Charts!', :title_color => 'FF0000', :title_size => '20')
|
39
|
-
|
40
|
-
==Colors
|
41
|
-
|
42
|
-
Specify a color with at least a 6-letter string of hexadecimal values in the format RRGGBB. For example:
|
43
|
-
|
44
|
-
* FF0000 = red
|
45
|
-
* 00FF00 = green
|
46
|
-
* 0000FF = blue
|
47
|
-
* 000000 = black
|
48
|
-
* FFFFFF = white
|
49
|
-
|
50
|
-
You can optionally specify transparency by appending a value between 00 and FF where 00 is completely transparent and FF completely opaque. For example:
|
51
|
-
|
52
|
-
* 0000FFFF = solid blue
|
53
|
-
* 0000FF00 = transparent blue
|
54
|
-
|
55
|
-
If you need to use multiple colors, check the doc. Usually you just need to pass :attribute => 'FF0000,00FF00'
|
56
|
-
|
57
|
-
Some charts have more options than other, make sure to refer to the documentation.
|
58
|
-
|
59
|
-
===Background options:
|
60
|
-
|
61
|
-
If you don't set the background option, your graph will be transparent.
|
62
|
-
|
63
|
-
* You have 3 types of background http://code.google.com/apis/chart/#chart_or_background_fill
|
64
|
-
|
65
|
-
- solid
|
66
|
-
- gradient
|
67
|
-
- stripes
|
68
|
-
|
69
|
-
By default, if you set a background color, the fill will be solid:
|
70
|
-
|
71
|
-
Gchart.bar(:bg => 'efefef')
|
72
|
-
|
73
|
-
However you can specify another fill type such as:
|
74
|
-
|
75
|
-
Gchart.line(:bg => {:color => 'efefef', :type => 'gradient'})
|
76
|
-
|
77
|
-
In the above code, we decided to have a gradient background, however since we only passed one color, the chart will start by the specified color and transition to white. By the default, the gradient angle is 0. Change it as follows:
|
78
|
-
|
79
|
-
Gchart.line(:title =>'bg example', :bg => {:color => 'efefef', :type => 'gradient', :angle => 90})
|
80
|
-
|
81
|
-
For a more advance use of colors, refer to http://code.google.com/apis/chart/#linear_gradient
|
82
|
-
|
83
|
-
Gchart.line(:bg => {:color => '76A4FB,1,ffffff,0', :type => 'gradient'})
|
84
|
-
|
85
|
-
|
86
|
-
The same way you set the background color, you can also set the graph background:
|
87
|
-
|
88
|
-
Gchart.line(:graph_bg => 'cccccc')
|
89
|
-
|
90
|
-
or both
|
91
|
-
|
92
|
-
Gchart.line(:bg => {:color => '76A4FB,1,ffffff,0', :type => 'gradient'}, :graph_bg => 'cccccc', :title => 'Sexy Chart')
|
93
|
-
|
94
|
-
|
95
|
-
Another type of fill is stripes http://code.google.com/apis/chart/#linear_stripes
|
96
|
-
|
97
|
-
Gchart.line(:bg => {:color => 'efefef', :type => 'stripes'})
|
98
|
-
|
99
|
-
You can customize the amount of stripes, colors and width by changing the color value.
|
100
|
-
|
101
|
-
|
102
|
-
== Legend & Labels
|
103
|
-
|
104
|
-
You probably will want to use a legend or labels for your graph.
|
105
|
-
|
106
|
-
Gchart.line(:legend => 'legend label')
|
107
|
-
or
|
108
|
-
Gchart.line(:legend => ['legend label 1', 'legend label 2'])
|
109
|
-
|
110
|
-
Will do the trick. You can also use the labels alias (makes more sense when using the pie charts)
|
111
|
-
|
112
|
-
chart = Gchart.pie(:labels => ['label 1', 'label 2'])
|
113
|
-
|
114
|
-
== Multiple axis labels
|
115
|
-
|
116
|
-
Multiple axis labels are available for line charts, bar charts and scatter plots.
|
117
|
-
|
118
|
-
* x = bottom x-axis
|
119
|
-
* t = top x-axis
|
120
|
-
* y = left y-axis
|
121
|
-
* r = right y-axis
|
122
|
-
|
123
|
-
Gchart.line(:label_axis => 'x,y,r')
|
124
|
-
|
125
|
-
To add labels on these axis:
|
126
|
-
|
127
|
-
Gchart.line(:axis_labels => ['Jan|July|Jan|July|Jan', '0|100', 'A|B|C', '2005|2006|2007'])
|
128
|
-
|
129
|
-
|
130
|
-
== Data options
|
131
|
-
|
132
|
-
Data are passed using an array or a nested array.
|
133
|
-
|
134
|
-
Gchart.bar(:data => [1,2,4,67,100,41,234])
|
135
|
-
|
136
|
-
Gchart.bar(:data => [[1,2,4,67,100,41,234],[45,23,67,12,67,300, 250]])
|
137
|
-
|
138
|
-
By default, the graph is drawn with your max value representing 100% of the height or width of the graph. You can change that my passing the max value.
|
139
|
-
|
140
|
-
Gchart.bar(:data => [1,2,4,67,100,41,234], :max_value => 300)
|
141
|
-
Gchart.bar(:data => [1,2,4,67,100,41,234], :max_value => 'auto')
|
142
|
-
|
143
|
-
or if you want to use the real values from your dataset:
|
144
|
-
|
145
|
-
Gchart.bar(:data => [1,2,4,67,100,41,234], :max_value => false)
|
146
|
-
|
147
|
-
|
148
|
-
You can also define a different encoding to add more granularity:
|
149
|
-
|
150
|
-
Gchart.bar(:data => [1,2,4,67,100,41,234], :encoding => 'simple')
|
151
|
-
Gchart.bar(:data => [1,2,4,67,100,41,234], :encoding => 'extended')
|
152
|
-
Gchart.bar(:data => [1,2,4,67,100,41,234], :encoding => 'text')
|
153
|
-
|
154
|
-
|
155
|
-
==Pies:
|
156
|
-
|
157
|
-
you have 2 type of pies:
|
158
|
-
- Gchart.pie() the standard 2D pie
|
159
|
-
_ Gchart.pie_3d() the fancy 3D pie
|
160
|
-
|
161
|
-
To set labels, you can use one of these two options:
|
162
|
-
|
163
|
-
@legend = ['Matt_fu', 'Rob_fu']
|
164
|
-
Gchart.pie_3d(:title => @title, :labels => @legend, :data => @data, :size => '400x200')
|
165
|
-
Gchart.pie_3d(:title => @title, :legend => @legend, :data => @data, :size => '400x200')
|
166
|
-
|
167
|
-
|
168
|
-
|
169
|
-
=== try yourself
|
170
|
-
|
171
|
-
Gchart.bar( :data => [[1,2,4,67,100,41,234],[45,23,67,12,67,300, 250]],
|
172
|
-
:title => 'SDRuby Fu level',
|
173
|
-
:legend => ['matt','patrick'],
|
174
|
-
:bg => {:color => '76A4FB', :type => 'gradient'},
|
175
|
-
:bar_colors => 'ff0000,00ff00')
|
176
|
-
|
177
|
-
"http://chart.apis.google.com/chart?chs=300x200&chdl=matt|patrick&chd=s:AAANUIv,JENCN9y&chtt=SDRuby+Fu+level&chf=bg,lg,0,76A4FB,0,ffffff,1&cht=bvs&chco=ff0000,00ff00"
|
178
|
-
|
179
|
-
Gchart.pie(:data => [20,10,15,5,50], :title => 'SDRuby Fu level', :size => '400x200', :labels => ['matt', 'rob', 'patrick', 'ryan', 'jordan'])
|
180
|
-
http://chart.apis.google.com/chart?cht=p&chs=400x200&chd=s:YMSG9&chtt=SDRuby+Fu+level&chl=matt|rob|patrick|ryan|jordan
|
9
|
+
http://github.com/mattetti/googlecharts
|
data/lib/gchart/version.rb
CHANGED
data/lib/gchart.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
$:.unshift File.dirname(__FILE__)
|
2
2
|
require 'gchart/version'
|
3
|
+
require 'gchart/theme'
|
3
4
|
require "open-uri"
|
4
5
|
require "uri"
|
5
6
|
|
@@ -15,27 +16,27 @@ class Gchart
|
|
15
16
|
@@file_name = 'chart.png'
|
16
17
|
|
17
18
|
attr_accessor :title, :type, :width, :height, :horizontal, :grouped, :legend, :data, :encoding, :max_value, :bar_colors,
|
18
|
-
:title_color, :title_size, :custom, :axis_with_labels, :axis_labels, :bar_width_and_spacing
|
19
|
+
:title_color, :title_size, :custom, :axis_with_labels, :axis_labels, :bar_width_and_spacing, :id, :alt, :class
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
21
|
+
# Support for Gchart.line(:title => 'my title', :size => '400x600')
|
22
|
+
def self.method_missing(m, options={})
|
23
|
+
# Start with theme defaults if a theme is set
|
24
|
+
theme = options[:theme]
|
25
|
+
options = theme ? Chart::Theme.load(theme).to_options.merge(options) : options
|
26
|
+
# Extract the format and optional filename, then clean the hash
|
27
|
+
format = options[:format] || 'url'
|
28
|
+
@@file_name = options[:filename] unless options[:filename].nil?
|
29
|
+
options.delete(:format)
|
30
|
+
options.delete(:filename)
|
31
|
+
# create the chart and return it in the format asked for
|
32
|
+
if @@types.include?(m.to_s)
|
33
|
+
chart = new(options.merge!({:type => m}))
|
34
|
+
chart.send(format)
|
35
|
+
elsif m.to_s == 'version'
|
36
|
+
Gchart::VERSION::STRING
|
37
|
+
else
|
38
|
+
"#{m} is not a supported chart format, please use one of the following: #{supported_types}."
|
39
|
+
end
|
39
40
|
end
|
40
41
|
|
41
42
|
def initialize(options={})
|
@@ -47,6 +48,12 @@ class Gchart
|
|
47
48
|
@grouped = false
|
48
49
|
@encoding = 'simple'
|
49
50
|
@max_value = 'auto'
|
51
|
+
# Sets the alt tag when chart is exported as image tag
|
52
|
+
@alt = 'Google Chart'
|
53
|
+
# Sets the CSS id selector when chart is exported as image tag
|
54
|
+
@id = false
|
55
|
+
# Sets the CSS class selector when chart is exported as image tag
|
56
|
+
@class = false
|
50
57
|
|
51
58
|
# set the options value if definable
|
52
59
|
options.each do |attribute, value|
|
@@ -123,10 +130,20 @@ class Gchart
|
|
123
130
|
|
124
131
|
# Format
|
125
132
|
|
126
|
-
def
|
127
|
-
"<img
|
133
|
+
def image_tag
|
134
|
+
image = "<img"
|
135
|
+
image += " id=\"#{@id}\"" if @id
|
136
|
+
image += " class=\"#{@class}\"" if @class
|
137
|
+
image += " src=\"#{query_builder(:html)}\""
|
138
|
+
image += " width=\"#{@width}\""
|
139
|
+
image += " height=\"#{@height}\""
|
140
|
+
image += " alt=\"#{@alt}\""
|
141
|
+
image += " title=\"#{@title}\"" if @title
|
142
|
+
image += " />"
|
128
143
|
end
|
129
144
|
|
145
|
+
alias_method :img_tag, :image_tag
|
146
|
+
|
130
147
|
def url
|
131
148
|
query_builder
|
132
149
|
end
|
@@ -355,7 +372,7 @@ class Gchart
|
|
355
372
|
end
|
356
373
|
|
357
374
|
|
358
|
-
def query_builder
|
375
|
+
def query_builder(options="")
|
359
376
|
query_params = instance_variables.map do |var|
|
360
377
|
case var
|
361
378
|
# Set the graph size
|
@@ -386,7 +403,15 @@ class Gchart
|
|
386
403
|
end
|
387
404
|
end.compact
|
388
405
|
|
389
|
-
|
406
|
+
# Use ampersand as default delimiter
|
407
|
+
unless options == :html
|
408
|
+
delimiter = '&'
|
409
|
+
# Escape ampersand for html image tags
|
410
|
+
else
|
411
|
+
delimiter = '&'
|
412
|
+
end
|
413
|
+
|
414
|
+
jstize(@@url + query_params.join(delimiter))
|
390
415
|
end
|
391
416
|
|
392
417
|
end
|
data/spec/gchart_spec.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
2
|
require File.dirname(__FILE__) + '/../lib/gchart'
|
3
3
|
|
4
|
+
Chart::Theme.add_theme_file("#{File.dirname(__FILE__)}/fixtures/test_theme.yml")
|
5
|
+
|
4
6
|
# Time to add your specs!
|
5
7
|
# http://rspec.rubyforge.org/
|
6
8
|
describe "generating a default Gchart" do
|
@@ -26,6 +28,11 @@ describe "generating a default Gchart" do
|
|
26
28
|
@chart.include?('cht=lc').should be_true
|
27
29
|
end
|
28
30
|
|
31
|
+
it 'should use theme defaults if theme is set' do
|
32
|
+
Gchart.line(:theme=>:test).include?('chco=6886B4,FDD84E').should be_true
|
33
|
+
Gchart.line(:theme=>:test).include?(Gchart.jstize('chf=c,s,FFFFFF|bg,s,FFFFFF')).should be_true
|
34
|
+
end
|
35
|
+
|
29
36
|
it "should use the simple encoding by default with auto max value" do
|
30
37
|
# 9 is the max value in simple encoding, 26 being our max value the 2nd encoded value should be 9
|
31
38
|
Gchart.line(:data => [0, 26]).include?('chd=s:A9').should be_true
|
@@ -377,10 +384,43 @@ describe 'exporting a chart' do
|
|
377
384
|
Gchart.line(:data => [0, 26], :format => 'url').should == Gchart.line(:data => [0, 26])
|
378
385
|
end
|
379
386
|
|
380
|
-
it "should be available as
|
381
|
-
Gchart.line(:data => [0, 26], :format => '
|
387
|
+
it "should be available as an image tag" do
|
388
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag').should match(/<img src=(.*) width="300" height="200" alt="Google Chart" \/>/)
|
389
|
+
end
|
390
|
+
|
391
|
+
it "should be available as an image tag using img_tag alias" do
|
392
|
+
Gchart.line(:data => [0, 26], :format => 'img_tag').should match(/<img src=(.*) width="300" height="200" alt="Google Chart" \/>/)
|
382
393
|
end
|
383
394
|
|
395
|
+
it "should be available as an image tag using custom dimensions" do
|
396
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :size => '400x400').should match(/<img src=(.*) width="400" height="400" alt="Google Chart" \/>/)
|
397
|
+
end
|
398
|
+
|
399
|
+
it "should be available as an image tag using custom alt text" do
|
400
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :alt => 'Sexy chart').should match(/<img src=(.*) width="300" height="200" alt="Sexy chart" \/>/)
|
401
|
+
end
|
402
|
+
|
403
|
+
it "should be available as an image tag using custom title text" do
|
404
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :title => 'Sexy chart').should match(/<img src=(.*) width="300" height="200" alt="Google Chart" title="Sexy chart" \/>/)
|
405
|
+
end
|
406
|
+
|
407
|
+
it "should be available as an image tag using custom css id selector" do
|
408
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :id => 'chart').should match(/<img id="chart" src=(.*) width="300" height="200" alt="Google Chart" \/>/)
|
409
|
+
end
|
410
|
+
|
411
|
+
it "should be available as an image tag using custom css class selector" do
|
412
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :class => 'chart').should match(/<img class="chart" src=(.*) width="300" height="200" alt="Google Chart" \/>/)
|
413
|
+
end
|
414
|
+
|
415
|
+
it "should use ampersands to separate key/value pairs in URLs by default" do
|
416
|
+
Gchart.line(:data => [0, 26]).should satisfy {|chart| chart.include? "&" }
|
417
|
+
Gchart.line(:data => [0, 26]).should_not satisfy {|chart| chart.include? "&" }
|
418
|
+
end
|
419
|
+
|
420
|
+
it "should escape ampersands in URLs when used as an image tag" do
|
421
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :class => 'chart').should satisfy {|chart| chart.include? "&" }
|
422
|
+
end
|
423
|
+
|
384
424
|
it "should be available as a file" do
|
385
425
|
File.delete('chart.png') if File.exist?('chart.png')
|
386
426
|
Gchart.line(:data => [0, 26], :format => 'file')
|
data/website/index.txt
CHANGED
@@ -5,7 +5,8 @@ h2. → 'Sexy Charts using Google API & Ruby'
|
|
5
5
|
|
6
6
|
h2. What
|
7
7
|
|
8
|
-
|
8
|
+
A nice and simple wrapper for "Google Chart API":http://code.google.com/apis/chart/
|
9
|
+
(Fully tested using RSpec, check the specs for more usage examples)
|
9
10
|
|
10
11
|
h2. Installing
|
11
12
|
|
@@ -52,17 +53,18 @@ or use rubyforge:
|
|
52
53
|
require:
|
53
54
|
<pre syntax="ruby">require 'gchart'</pre>
|
54
55
|
|
55
|
-
<pre syntax="ruby">
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
56
|
+
<pre syntax="ruby">
|
57
|
+
Gchart.line(:size => '200x300',
|
58
|
+
:title => "example title",
|
59
|
+
:bg => 'efefef',
|
60
|
+
:legend => ['first data set label', 'second data set label'],
|
61
|
+
:data => [10, 30, 120, 45, 72])</pre>
|
60
62
|
|
61
63
|
---
|
62
64
|
|
63
65
|
*simple line chart*
|
64
66
|
<pre syntax="ruby">
|
65
|
-
|
67
|
+
Gchart.line(:data => [0, 40, 10, 70, 20])
|
66
68
|
</pre>
|
67
69
|
|
68
70
|
Generate the following url: http://chart.apis.google.com/chart?chs=300x200&chd=s:AiI9R&cht=lc
|
@@ -73,7 +75,7 @@ Inserted in an image tag, it will look like that:
|
|
73
75
|
|
74
76
|
*multiple line charts*
|
75
77
|
<pre syntax="ruby">
|
76
|
-
|
78
|
+
Gchart.line(:data => [[0, 40, 10, 70, 20],[41, 10, 80, 50]])
|
77
79
|
</pre>
|
78
80
|
|
79
81
|
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:AeH1P,fH9m(multiple lines chart)!
|
@@ -81,7 +83,7 @@ Inserted in an image tag, it will look like that:
|
|
81
83
|
*set line colors*
|
82
84
|
|
83
85
|
<pre syntax="ruby">
|
84
|
-
|
86
|
+
Gchart.line(:data => [[0, 40, 10, 70, 20],[41, 10, 80, 50]], :line_colors => "FF0000,00FF00")
|
85
87
|
</pre>
|
86
88
|
|
87
89
|
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:AeH1P,fH9m&chco=FF0000,00FF00(line colors)!
|
@@ -91,8 +93,8 @@ Inserted in an image tag, it will look like that:
|
|
91
93
|
*sparkline chart*
|
92
94
|
|
93
95
|
<pre syntax="ruby">
|
94
|
-
|
95
|
-
|
96
|
+
data = [27,25,25,25,25,27,100,31,25,36,25,25,39,25,31,25,25,25,26,26,25,25,28,25,25,100,28,27,31,25,27,27,29,25,27,26,26,25,26,26,35,33,34,25,26,25,36,25,26,37,33,33,37,37,39,25,25,25,25]
|
97
|
+
Gchart.sparkline(:data => data, :size => '120x40', :line_colors => '0077CC')
|
96
98
|
</pre>
|
97
99
|
|
98
100
|
!http://chart.apis.google.com/chart?chd=s:QPPPPQ9SPVPPXPSPPPPPPPRPP9RQSPQQRPQPPPPPVUUPPPVPPWUUWWXPPPP&chco=0077CC&chs=120x40&cht=ls(sparline)!
|
@@ -102,21 +104,21 @@ A sparkline chart has exactly the same parameters as a line chart. The only diff
|
|
102
104
|
*bar chart*
|
103
105
|
|
104
106
|
<pre syntax="ruby">
|
105
|
-
|
107
|
+
Gchart.bar(:data => [300, 100, 30, 200])
|
106
108
|
</pre>
|
107
109
|
!http://chart.apis.google.com/chart?cht=bvs&chs=300x200&chd=s:9UGo(bars)!
|
108
110
|
|
109
111
|
*set the bar chart orientation*
|
110
112
|
|
111
113
|
<pre syntax="ruby">
|
112
|
-
|
114
|
+
Gchart.bar(:data => [300, 100, 30, 200], :orientation => 'horizontal')
|
113
115
|
</pre>
|
114
116
|
!http://chart.apis.google.com/chart?cht=bhs&chs=300x200&chd=s:9UGo(bars)!
|
115
117
|
|
116
118
|
*multiple bars chart*
|
117
119
|
|
118
120
|
<pre syntax="ruby">
|
119
|
-
|
121
|
+
Gchart.bar(:data => [[300, 100, 30, 200], [100, 200, 300, 10]])
|
120
122
|
</pre>
|
121
123
|
|
122
124
|
!http://chart.apis.google.com/chart?cht=bvs&chs=300x200&chd=s:9UGo,Uo9C(stacked multiple bars)!
|
@@ -124,13 +126,13 @@ A sparkline chart has exactly the same parameters as a line chart. The only diff
|
|
124
126
|
The problem is that by default the bars are stacked, so we need to set the colors:
|
125
127
|
|
126
128
|
<pre syntax="ruby">
|
127
|
-
|
129
|
+
Gchart.bar(:data => [[300, 100, 30, 200], [100, 200, 300, 10]], :bar_colors => 'FF0000,00FF00')
|
128
130
|
</pre>
|
129
131
|
|
130
132
|
If you prefer you can use this other syntax:
|
131
133
|
|
132
134
|
<pre syntax="ruby">
|
133
|
-
|
135
|
+
Gchart.bar(:data => [[300, 100, 30, 200], [100, 200, 300, 10]], :bar_colors => ['FF0000', '00FF00'])
|
134
136
|
</pre>
|
135
137
|
|
136
138
|
!http://chart.apis.google.com/chart?cht=bvs&chs=300x200&chd=s:9UGo,Uo9C&chco=FF0000,00FF00(colors)!
|
@@ -138,9 +140,9 @@ If you prefer you can use this other syntax:
|
|
138
140
|
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:
|
139
141
|
|
140
142
|
<pre syntax="ruby">
|
141
|
-
|
142
|
-
|
143
|
-
|
143
|
+
Gchart.bar(:data => [[300, 100, 30, 200], [100, 200, 300, 10]],
|
144
|
+
:bar_colors => 'FF0000,00FF00',
|
145
|
+
:stacked => false )
|
144
146
|
</pre>
|
145
147
|
|
146
148
|
!http://chart.apis.google.com/chart?cht=bvg&chs=300x200&chd=s:9UGo,Uo9C&chco=FF0000,00FF00(grouped bars)!
|
@@ -152,31 +154,31 @@ A bar chart can accept options to set the width of the bars, spacing between bar
|
|
152
154
|
The Google API sets these options in the order of width, spacing, and group spacing, with both spacing values being optional. So, if you provide a string or array, provide them in that order:
|
153
155
|
|
154
156
|
<pre syntax="ruby">
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
157
|
+
Gchart.bar(:data => @data, :bar_width_and_spacing => '25,6') # width of 25, spacing of 6
|
158
|
+
Gchart.bar(:data => @data, :bar_width_and_spacing => '25,6,12') # width of 25, spacing of 6, group spacing of 12
|
159
|
+
Gchart.bar(:data => @data, :bar_width_and_spacing => [25,6]) # width of 25, spacing of 6
|
160
|
+
Gchart.bar(:data => @data, :bar_width_and_spacing => 25) # width of 25
|
159
161
|
</pre>
|
160
162
|
|
161
163
|
The hash lets you set these values directly, with the Google default values set for any options you don't include:
|
162
164
|
|
163
165
|
<pre syntax="ruby">
|
164
|
-
|
165
|
-
|
166
|
+
Gchart.bar(:data => @data, :bar_width_and_spacing => {:width => 19})
|
167
|
+
Gchart.bar(:data => @data, :bar_width_and_spacing => {:spacing => 10, :group_spacing => 12})
|
166
168
|
</pre>
|
167
169
|
|
168
170
|
|
169
171
|
*pie chart*
|
170
172
|
|
171
173
|
<pre syntax="ruby">
|
172
|
-
|
174
|
+
Gchart.pie(:data => [20, 35, 45])
|
173
175
|
</pre>
|
174
176
|
!http://chart.apis.google.com/chart?cht=p&chs=300x200&chd=s:bv9(Pie Chart)!
|
175
177
|
|
176
178
|
*3D pie chart*
|
177
179
|
|
178
180
|
<pre syntax="ruby">
|
179
|
-
|
181
|
+
Gchart.pie_3d(:data => [20, 35, 45])
|
180
182
|
</pre>
|
181
183
|
!http://chart.apis.google.com/chart?cht=p3&chs=300x200&chd=s:bv9(Pie Chart)!
|
182
184
|
|
@@ -192,7 +194,7 @@ Data set:
|
|
192
194
|
* the seventh value specifies the area of A intersecting B intersecting C
|
193
195
|
|
194
196
|
<pre syntax="ruby">
|
195
|
-
|
197
|
+
Gchart.venn(:data => [100, 80, 60, 30, 30, 30, 10])
|
196
198
|
</pre>
|
197
199
|
!http://chart.apis.google.com/chart?cht=v&chs=300x200&chd=s:9wkSSSG(Venn)!
|
198
200
|
|
@@ -203,7 +205,7 @@ Data set:
|
|
203
205
|
Supply two data sets, the first data set specifies x coordinates, the second set specifies y coordinates, the third set the data point size.
|
204
206
|
|
205
207
|
<pre syntax="ruby">
|
206
|
-
|
208
|
+
Gchart.scatter(:data => [[1, 2, 3, 4, 5], [1, 2, 3, 4 ,5], [5, 4, 3, 2, 1]])
|
207
209
|
</pre>
|
208
210
|
|
209
211
|
!http://chart.apis.google.com/chart?cht=s&chs=300x200&chd=s:MYkw9,MYkw9,9wkYM(scatter)!
|
@@ -215,15 +217,60 @@ Supply two data sets, the first data set specifies x coordinates, the second set
|
|
215
217
|
Supply a single label that will be what the arrow points to. It only supports a solid fill for the background.
|
216
218
|
|
217
219
|
<pre syntax="ruby">
|
218
|
-
|
220
|
+
Gchart.meter(:data => [70], :label => ['Flavor'])
|
221
|
+
</pre>
|
222
|
+
|
223
|
+
|
224
|
+
*Chart themes*
|
225
|
+
|
226
|
+
Googlecharts comes with 4 themes: keynote, thirty7signals, pastel and greyscale. (ganked from "Gruff": http://github.com/topfunky/gruff/tree/master )
|
227
|
+
|
228
|
+
<pre syntax="ruby">
|
229
|
+
Gchart.line(
|
230
|
+
:theme => :keynote,
|
231
|
+
:data => [[0,40,10,70,20],[41,10,80,50,40],[20,60,30,60,80],[5,23,35,10,56],[80,90,5,30,60]],
|
232
|
+
:title => 'keynote'
|
233
|
+
)
|
234
|
+
</pre>
|
235
|
+
|
236
|
+
* keynote
|
237
|
+
|
238
|
+
!http://chart.apis.google.com/chart?chtt=keynote&chco=6886B4,FDD84E,72AE6E,D1695E,8A6EAF,EFAA43&chs=300x200&cht=lc&chd=s:AbGvN,bG2hb,NoUo2,DPXGl,29DUo&chf=c,s,FFFFFF|bg,s,000000!
|
239
|
+
|
240
|
+
* thirty7signals
|
241
|
+
|
242
|
+
!http://chart.apis.google.com/chart?chtt=thirty7signals&chco=FFF804,336699,339933,ff0000,cc99cc,cf5910&chs=300x200&cht=lc&chd=s:AbGvN,bG2hb,NoUo2,DPXGl,29DUo&chf=bg,s,FFFFFF!
|
243
|
+
|
244
|
+
* pastel
|
245
|
+
|
246
|
+
!http://chart.apis.google.com/chart?chtt=pastel&chco=a9dada,aedaa9,daaea9,dadaa9,a9a9da&chs=300x200&cht=lc&chd=s:AbGvN,bG2hb,NoUo2,DPXGl,29DUo!
|
247
|
+
|
248
|
+
* greyscale
|
249
|
+
|
250
|
+
!http://chart.apis.google.com/chart?chtt=greyscale&chco=282828,383838,686868,989898,c8c8c8,e8e8e8&chs=300x200&cht=lc&chd=s:AbGvN,bG2hb,NoUo2,DPXGl,29DUo!
|
251
|
+
|
252
|
+
|
253
|
+
You can also use your own theme. Create a yml file using the same format as the themes located in lib/themes.yml
|
254
|
+
|
255
|
+
Load your theme(s):
|
256
|
+
|
257
|
+
<pre syntax="ruby">
|
258
|
+
Chart::Theme.add_theme_file("#{File.dirname(__FILE__)}/fixtures/another_test_theme.yml")
|
219
259
|
</pre>
|
220
260
|
|
261
|
+
And use the standard method signature to use your own theme:
|
262
|
+
|
263
|
+
<pre syntax="ruby">
|
264
|
+
Gchart.line(:theme => :custom_theme, :data => [[0, 40, 10, 70, 20],[41, 10, 80, 50]], :title => 'greyscale')
|
265
|
+
</pre>
|
266
|
+
|
267
|
+
|
221
268
|
---
|
222
269
|
|
223
270
|
*set a chart title*
|
224
271
|
|
225
272
|
<pre syntax="ruby">
|
226
|
-
|
273
|
+
Gchart.bar(:title => "Recent Chart Sexyness", :data => [15, 30, 10, 20, 100, 20, 40, 100])
|
227
274
|
</pre>
|
228
275
|
|
229
276
|
!http://chart.apis.google.com/chart?cht=bvs&chs=300x200&chd=s:JSGM9MY9&chtt=Recent+Chart+Sexyness(chart title)!
|
@@ -231,7 +278,7 @@ Supply a single label that will be what the arrow points to. It only supports a
|
|
231
278
|
*set the title size*
|
232
279
|
|
233
280
|
<pre syntax="ruby">
|
234
|
-
|
281
|
+
Gchart.bar(:title => "Recent Chart Sexyness", :title_size => 20, :data => [15, 30, 10, 20, 100, 20, 40, 100])
|
235
282
|
</pre>
|
236
283
|
|
237
284
|
!http://chart.apis.google.com/chart?cht=bvs&chs=300x200&chd=s:JSGM9MY9&chtt=Recent+Chart+Sexyness&chts=454545,20(title size)!
|
@@ -239,7 +286,7 @@ Supply a single label that will be what the arrow points to. It only supports a
|
|
239
286
|
*set the title color*
|
240
287
|
|
241
288
|
<pre syntax="ruby">
|
242
|
-
|
289
|
+
Gchart.bar(:title => "Recent Chart Sexyness", :title_color => 'FF0000', :data => [15, 30, 10, 20, 100, 20, 40, 100])
|
243
290
|
</pre>
|
244
291
|
|
245
292
|
!http://chart.apis.google.com/chart?cht=bvs&chs=300x200&chd=s:JSGM9MY9&chtt=Recent+Chart+Sexyness&chts=FF0000(Title color)!
|
@@ -247,9 +294,9 @@ Supply a single label that will be what the arrow points to. It only supports a
|
|
247
294
|
*set the chart's size*
|
248
295
|
|
249
296
|
<pre syntax="ruby">
|
250
|
-
|
251
|
-
|
252
|
-
|
297
|
+
Gchart.bar(:title => "Recent Chart Sexyness",
|
298
|
+
:data => [15, 30, 10, 20, 100, 20, 40, 100],
|
299
|
+
:size => '600x400')
|
253
300
|
</pre>
|
254
301
|
|
255
302
|
!http://chart.apis.google.com/chart?cht=bvs&chs=600x400&chd=s:JSGM9MY9&chtt=Recent+Chart+Sexyness(size)!
|
@@ -257,9 +304,9 @@ Supply a single label that will be what the arrow points to. It only supports a
|
|
257
304
|
*set the image background color*
|
258
305
|
|
259
306
|
<pre syntax="ruby">
|
260
|
-
|
261
|
-
|
262
|
-
|
307
|
+
Gchart.bar(:title => "Matt's Mojo",
|
308
|
+
:data => [15, 30, 10, 20, 100, 20, 40, 100, 90, 100, 80],
|
309
|
+
:background => 'FF9994')
|
263
310
|
</pre>
|
264
311
|
|
265
312
|
!http://chart.apis.google.com/chart?chf=bg,s,FF9994&cht=bvs&chs=300x200&chd=s:JSGM9MY929w&chtt=Matt's+Mojo(Background)!
|
@@ -267,9 +314,9 @@ Supply a single label that will be what the arrow points to. It only supports a
|
|
267
314
|
*set the chart background color*
|
268
315
|
|
269
316
|
<pre syntax="ruby">
|
270
|
-
|
271
|
-
|
272
|
-
|
317
|
+
Gchart.bar(:title => "Matt's Mojo",
|
318
|
+
:data => [15, 30, 10, 20, 100, 20, 40, 100, 90, 100, 80],
|
319
|
+
:background => 'FF9994', :chart_background => '000000')
|
273
320
|
</pre>
|
274
321
|
|
275
322
|
!http://chart.apis.google.com/chart?chf=c,s,000000|bg,s,FF9994&cht=bvs&chs=300x200&chd=s:JSGM9MY929w&chtt=Matt's+Mojo(chart background)!
|
@@ -277,18 +324,18 @@ Supply a single label that will be what the arrow points to. It only supports a
|
|
277
324
|
*Set bar/line colors*
|
278
325
|
|
279
326
|
<pre syntax="ruby">
|
280
|
-
|
281
|
-
|
282
|
-
|
283
|
-
|
327
|
+
Gchart.bar(:title => "Matt's Mojo",
|
328
|
+
:data => [15, 30, 10, 20, 100, 20, 40, 100, 90, 100, 80],
|
329
|
+
:bar_colors => '76A4FB',
|
330
|
+
:background => 'EEEEEE', :chart_background => 'CCCCCC')
|
284
331
|
</pre>
|
285
332
|
|
286
333
|
!http://chart.apis.google.com/chart?chf=c,s,CCCCCC|bg,s,EEEEEE&cht=bvs&chs=300x200&chd=s:JSGM9MY929w&chco=76A4FB&chtt=Matt's+Mojo(bar colors)!
|
287
334
|
|
288
335
|
<pre syntax="ruby">
|
289
|
-
|
290
|
-
|
291
|
-
|
336
|
+
Gchart.line(:title => "Matt's Mojo",
|
337
|
+
:data => [15, 30, 10, 20, 100, 20, 40, 100, 90, 100, 80],
|
338
|
+
:line_colors => '76A4FB')
|
292
339
|
</pre>
|
293
340
|
|
294
341
|
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:JSGM9MY929w&chco=76A4FB&chtt=Matt's+Mojo(line colors)!
|
@@ -296,27 +343,27 @@ Supply a single label that will be what the arrow points to. It only supports a
|
|
296
343
|
*legend / labels*
|
297
344
|
|
298
345
|
<pre syntax="ruby">
|
299
|
-
|
300
|
-
|
301
|
-
|
302
|
-
|
303
|
-
|
346
|
+
Gchart.bar(:title => "Matt vs Rob",
|
347
|
+
:data => [[300, 100, 30, 200], [100, 200, 300, 10]],
|
348
|
+
:bar_colors => 'FF0000,00FF00',
|
349
|
+
:stacked => false, :size => '400x200',
|
350
|
+
:legend => ["Matt's Mojo", "Rob's Mojo"] )
|
304
351
|
</pre>
|
305
352
|
!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)!
|
306
353
|
|
307
354
|
<pre syntax="ruby">
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
|
312
|
-
|
355
|
+
Gchart.line(:title => "Matt vs Rob",
|
356
|
+
:data => [[300, 100, 30, 200], [100, 200, 300, 10]],
|
357
|
+
:bar_colors => ['FF0000','00FF00'],
|
358
|
+
:stacked => false, :size => '400x200',
|
359
|
+
:legend => ["Matt's Mojo", "Rob's Mojo"] )
|
313
360
|
</pre>
|
314
361
|
!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)!
|
315
362
|
|
316
363
|
|
317
364
|
<pre syntax="ruby">
|
318
|
-
|
319
|
-
|
365
|
+
Gchart.pie_3d(:title => 'ruby_fu', :size => '400x200',
|
366
|
+
:data => [10, 45, 45], :labels => ["DHH", "Rob", "Matt"] )
|
320
367
|
</pre>
|
321
368
|
|
322
369
|
!http://chart.apis.google.com/chart?cht=p3&chl=DHH|Rob|Matt&chs=400x200&chd=s:N99&chtt=ruby_fu(labels)!
|
@@ -324,27 +371,27 @@ Supply a single label that will be what the arrow points to. It only supports a
|
|
324
371
|
*Display axis labels*
|
325
372
|
|
326
373
|
<pre syntax="ruby">
|
327
|
-
|
374
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x,y,r')
|
328
375
|
</pre>
|
329
376
|
|
330
377
|
or you can use the other syntax:
|
331
378
|
|
332
379
|
<pre syntax="ruby">
|
333
|
-
|
380
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => ['x','y','r'])
|
334
381
|
</pre>
|
335
382
|
|
336
383
|
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chxt=x,y,r&chd=s:9UGoUo9C(axis with labels)!
|
337
384
|
|
338
385
|
<pre syntax="ruby">
|
339
|
-
|
340
|
-
|
386
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x',
|
387
|
+
:axis_labels => ['Jan|July|Jan|July|Jan'])
|
341
388
|
</pre>
|
342
389
|
|
343
390
|
or you can use the other syntax:
|
344
391
|
|
345
392
|
<pre syntax="ruby">
|
346
|
-
|
347
|
-
|
393
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x',
|
394
|
+
:axis_labels => ['Jan','July','Jan','July','Jan'])
|
348
395
|
</pre>
|
349
396
|
|
350
397
|
!http://chart.apis.google.com/chart?cht=lc&chxl=0:|Jan|July|Jan|July|Jan&chs=300x200&chxt=x&chd=s:9UGoUo9C(x labels)!
|
@@ -352,15 +399,15 @@ or you can use the other syntax:
|
|
352
399
|
*multiple axis labels*
|
353
400
|
|
354
401
|
<pre syntax="ruby">
|
355
|
-
|
356
|
-
|
402
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x,r',
|
403
|
+
:axis_labels => ['Jan|July|Jan|July|Jan', '2005|2006|2007'])
|
357
404
|
</pre>
|
358
405
|
|
359
406
|
or
|
360
407
|
|
361
408
|
<pre syntax="ruby">
|
362
|
-
|
363
|
-
|
409
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :axis_with_labels => 'x,r',
|
410
|
+
:axis_labels => [['Jan','July','Jan','July','Jan'], ['2005','2006','2007']])
|
364
411
|
</pre>
|
365
412
|
|
366
413
|
!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)!
|
@@ -372,7 +419,7 @@ or
|
|
372
419
|
I certainly didn't cover the entire API, if you want to add your own params:
|
373
420
|
|
374
421
|
<pre syntax="ruby">
|
375
|
-
|
422
|
+
Gchart.line(:custom => 'chd=s:93zyvneTTOMJMLIJFHEAECFJGHDBFCFIERcgnpy45879,IJKNUWUWYdnswz047977315533zy1246872tnkgcaZQONHCECAAAAEII&chls=3,6,3|1,1,0')
|
376
423
|
</pre>
|
377
424
|
|
378
425
|
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:93zyvneTTOMJMLIJFHEAECFJGHDBFCFIERcgnpy45879,IJKNUWUWYdnswz047977315533zy1246872tnkgcaZQONHCECAAAAEII&chls=3,6,3|1,1,0(Custom)!
|
@@ -384,24 +431,38 @@ I certainly didn't cover the entire API, if you want to add your own params:
|
|
384
431
|
You might prefer to save the chart instead of using the url, not a problem:
|
385
432
|
|
386
433
|
<pre syntax="ruby">
|
387
|
-
|
434
|
+
Gchart.line(:data => [0, 26], :format => 'file')
|
388
435
|
</pre>
|
389
436
|
|
390
437
|
You might want to specify the path and/or the filename used to save your chart:
|
391
438
|
|
392
439
|
<pre syntax="ruby">
|
393
|
-
|
440
|
+
Gchart.line(:data => [0, 26], :format => 'file', :filename => 'custom_filename.png')
|
394
441
|
</pre>
|
395
442
|
|
396
443
|
*Insert as an image tag*
|
397
444
|
|
398
|
-
Because, I'm lazy,
|
445
|
+
Because, I'm lazy, you can generate a full image tag, with support for standard html options.
|
446
|
+
|
447
|
+
<pre syntax="ruby">
|
448
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag')
|
449
|
+
</pre>
|
450
|
+
|
451
|
+
<pre syntax="ruby">
|
452
|
+
<img src="http://chart.apis.google.com/chart?chs=300x200&chd=s:A9&cht=lc" width="300" height="200" alt="Google Chart" />
|
453
|
+
</pre>
|
454
|
+
|
455
|
+
Here are a few more examples:
|
399
456
|
|
400
457
|
<pre syntax="ruby">
|
401
|
-
|
458
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag')
|
459
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :id => "sexy")
|
460
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :class => "chart")
|
461
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :alt => "Sexy Chart")
|
462
|
+
Gchart.line(:data => [0, 26], :format => 'image_tag', :title => "Sexy Chart")
|
402
463
|
</pre>
|
403
464
|
|
404
|
-
|
465
|
+
Image dimensions will be automatically set based on your chart's size.
|
405
466
|
|
406
467
|
---
|
407
468
|
|
@@ -417,17 +478,17 @@ By default this library uses the simple encoding, if you need a different type o
|
|
417
478
|
|
418
479
|
default / simple: chd=s:9UGoUo9C
|
419
480
|
<pre syntax="ruby">
|
420
|
-
Gchart.line(
|
481
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10] )
|
421
482
|
</pre>
|
422
483
|
|
423
484
|
extended: chd=e:..VVGZqqVVqq..CI
|
424
485
|
<pre syntax="ruby">
|
425
|
-
|
486
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :encoding => 'extended' )
|
426
487
|
</pre>
|
427
488
|
|
428
489
|
text: chd=t:300,100,30,200,100,200,300,10
|
429
490
|
<pre syntax="ruby">
|
430
|
-
|
491
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :encoding => 'text' )
|
431
492
|
</pre>
|
432
493
|
|
433
494
|
(note that the text encoding doesn't use a max value and therefore should be under 100)
|
@@ -439,29 +500,61 @@ Simple and extended encoding support the max value option.
|
|
439
500
|
The max value option is a simple way of scaling your graph. The data is converted in chart value with the highest chart value being the highest point on the graph. By default, the calculation is done for you. However you can specify your own maximum or not use a maximum at all.
|
440
501
|
|
441
502
|
<pre syntax="ruby">
|
442
|
-
|
503
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10] )
|
443
504
|
</pre>
|
444
505
|
|
445
506
|
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:9UGoUo9C(Title)!
|
446
507
|
|
447
508
|
<pre syntax="ruby">
|
448
|
-
|
509
|
+
Gchart.line(:data => [300, 100, 30, 200, 100, 200, 300, 10], :max_value => 500 )
|
449
510
|
</pre>
|
450
511
|
|
451
512
|
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:kMDYMYkB(max 500)!
|
452
513
|
|
453
514
|
<pre syntax="ruby">
|
454
|
-
|
515
|
+
Gchart.line(:data => [100, 20, 30, 20, 10, 14, 30, 10], :max_value => false )
|
455
516
|
</pre>
|
456
517
|
|
457
518
|
!http://chart.apis.google.com/chart?cht=lc&chs=300x200&chd=s:_UeUKOeK(real size)!
|
458
519
|
|
459
520
|
|
460
|
-
|
461
521
|
h2. Repository
|
462
522
|
|
463
523
|
The trunk repository is <code>http://github.com/mattetti/googlecharts/</code> for anonymous access.
|
464
524
|
|
525
|
+
h2. People reported using this gem
|
526
|
+
|
527
|
+
|
528
|
+
<div>
|
529
|
+
<img src="http://img.skitch.com/20080627-r14subqdx2ye3w13qefbx974gc.png" alt="github"/><br/>
|
530
|
+
<li><a href="http://github.com">http://github.com</a></li><br/>
|
531
|
+
</div>
|
532
|
+
|
533
|
+
<div>
|
534
|
+
<img src="http://stafftool.com/images/masthead_screen.gif" alt="stafftool"/><br/>
|
535
|
+
<li><a href="http://stafftool.com/">Takeo(contributor)</a></li><br/>
|
536
|
+
</div>
|
537
|
+
|
538
|
+
<div>
|
539
|
+
<img src="http://img.skitch.com/20080627-g2pp89h7gdbh15m1rr8hx48jep.jpg" alt="graffletopia"/><br/>
|
540
|
+
<li><a href="http://graffletopia.com"> http://graffletopia.com Mokolabs(contributor)</a></li><br/>
|
541
|
+
</div>
|
542
|
+
|
543
|
+
<div>
|
544
|
+
<img src="http://img.skitch.com/20080627-kc1weqsbkmxeqhwiyriq3n6g8k.jpg" alt="gumgum"/><br/>
|
545
|
+
<li><a href="http://gumgum.com"> http://gumgum.com Mattetti(contributor)</a></li><br/>
|
546
|
+
</div>
|
547
|
+
|
548
|
+
<div>
|
549
|
+
<img src="http://img.skitch.com/20080627-n48j8pb2r7irsewfeh4yp3da12.jpg" alt="feedflix"/><br/>
|
550
|
+
<li><a href="http://feedflix.com/"> http://feedflix.com/</a></li><br/>
|
551
|
+
</div>
|
552
|
+
|
553
|
+
<div>
|
554
|
+
<li><a href="http://www.csuchico.edu/"> California State University, Chico</a></li><br/>
|
555
|
+
</div>
|
556
|
+
|
557
|
+
|
465
558
|
h2. License
|
466
559
|
|
467
560
|
This code is free to use under the terms of the MIT license.
|
@@ -473,4 +566,5 @@ Comments are welcome. Send an email to "Matt Aimonetti":mailto:mattaimonetti@gma
|
|
473
566
|
h3. Contributors
|
474
567
|
|
475
568
|
"David Grandinetti":http://github.com/dbgrandi
|
476
|
-
"Toby Sterrett":http://github.com/takeo
|
569
|
+
"Toby Sterrett":http://github.com/takeo
|
570
|
+
"Patrick Crowley":http://github.com/mokolabs
|