googlecharts 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/googlecharts.gemspec +77 -0
- data/lib/gchart.rb +10 -6
- data/lib/gchart/aliases.rb +0 -1
- data/lib/gchart/version.rb +2 -2
- data/spec/gchart_spec.rb +6 -1
- metadata +4 -6
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.6.
|
1
|
+
1.6.2
|
@@ -0,0 +1,77 @@
|
|
1
|
+
# Generated by jeweler
|
2
|
+
# DO NOT EDIT THIS FILE DIRECTLY
|
3
|
+
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
|
4
|
+
# -*- encoding: utf-8 -*-
|
5
|
+
|
6
|
+
Gem::Specification.new do |s|
|
7
|
+
s.name = %q{googlecharts}
|
8
|
+
s.version = "1.6.2"
|
9
|
+
|
10
|
+
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
|
+
s.authors = ["Matt Aimonetti"]
|
12
|
+
s.date = %q{2011-04-13}
|
13
|
+
s.description = %q{Generate charts using Google API & Ruby}
|
14
|
+
s.email = %q{mattaimonetti@gmail.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README",
|
17
|
+
"README.markdown",
|
18
|
+
"README.txt"
|
19
|
+
]
|
20
|
+
s.files = [
|
21
|
+
"History.txt",
|
22
|
+
"License.txt",
|
23
|
+
"Manifest.txt",
|
24
|
+
"README",
|
25
|
+
"README.markdown",
|
26
|
+
"README.txt",
|
27
|
+
"Rakefile",
|
28
|
+
"VERSION",
|
29
|
+
"config/hoe.rb",
|
30
|
+
"config/requirements.rb",
|
31
|
+
"googlecharts.gemspec",
|
32
|
+
"lib/gchart.rb",
|
33
|
+
"lib/gchart/aliases.rb",
|
34
|
+
"lib/gchart/theme.rb",
|
35
|
+
"lib/gchart/version.rb",
|
36
|
+
"lib/googlecharts.rb",
|
37
|
+
"lib/themes.yml",
|
38
|
+
"script/destroy",
|
39
|
+
"script/generate",
|
40
|
+
"script/txt2html",
|
41
|
+
"setup.rb",
|
42
|
+
"spec/fixtures/another_test_theme.yml",
|
43
|
+
"spec/fixtures/test_theme.yml",
|
44
|
+
"spec/gchart_spec.rb",
|
45
|
+
"spec/spec_helper.rb",
|
46
|
+
"spec/theme_spec.rb",
|
47
|
+
"tasks/deployment.rake",
|
48
|
+
"tasks/environment.rake",
|
49
|
+
"tasks/rspec.rake",
|
50
|
+
"tasks/website.rake",
|
51
|
+
"website/index.html",
|
52
|
+
"website/index.txt",
|
53
|
+
"website/javascripts/rounded_corners_lite.inc.js",
|
54
|
+
"website/stylesheets/screen.css",
|
55
|
+
"website/template.rhtml"
|
56
|
+
]
|
57
|
+
s.homepage = %q{http://googlecharts.rubyforge.org/}
|
58
|
+
s.require_paths = ["lib"]
|
59
|
+
s.rubygems_version = %q{1.3.7}
|
60
|
+
s.summary = %q{Generate charts using Google API & Ruby}
|
61
|
+
s.test_files = [
|
62
|
+
"spec/gchart_spec.rb",
|
63
|
+
"spec/spec_helper.rb",
|
64
|
+
"spec/theme_spec.rb"
|
65
|
+
]
|
66
|
+
|
67
|
+
if s.respond_to? :specification_version then
|
68
|
+
current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
|
69
|
+
s.specification_version = 3
|
70
|
+
|
71
|
+
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
72
|
+
else
|
73
|
+
end
|
74
|
+
else
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
data/lib/gchart.rb
CHANGED
@@ -33,7 +33,7 @@ class Gchart
|
|
33
33
|
'chart.png'
|
34
34
|
end
|
35
35
|
|
36
|
-
attr_accessor :title, :type, :width, :height, :curved, :horizontal, :grouped, :legend, :data, :encoding, :bar_colors,
|
36
|
+
attr_accessor :title, :type, :width, :height, :curved, :horizontal, :grouped, :legend, :labels, :data, :encoding, :bar_colors,
|
37
37
|
:title_color, :title_size, :custom, :axis_with_labels, :axis_labels, :bar_width_and_spacing, :id, :alt, :klass,
|
38
38
|
:range_markers, :geographical_area, :map_colors, :country_codes, :axis_range, :filename, :min, :max, :colors, :usemap
|
39
39
|
|
@@ -397,8 +397,10 @@ class Gchart
|
|
397
397
|
# or
|
398
398
|
# Gchart.line(:legend => ['first label', 'last label'])
|
399
399
|
def set_legend
|
400
|
-
|
401
|
-
|
400
|
+
if type.to_s =~ /pie|pie_3d|meter/
|
401
|
+
@labels = legend
|
402
|
+
return set_labels
|
403
|
+
end
|
402
404
|
if legend.is_a?(Array)
|
403
405
|
"chdl=#{@legend.map{|label| "#{CGI::escape(label.to_s)}"}.join('|')}"
|
404
406
|
else
|
@@ -420,10 +422,10 @@ class Gchart
|
|
420
422
|
end
|
421
423
|
|
422
424
|
def set_labels
|
423
|
-
if
|
424
|
-
"chl=#{@
|
425
|
+
if labels.is_a?(Array)
|
426
|
+
"chl=#{@labels.map{|label| "#{CGI::escape(label.to_s)}"}.join('|')}"
|
425
427
|
else
|
426
|
-
"chl=#{@
|
428
|
+
"chl=#{@labels}"
|
427
429
|
end
|
428
430
|
end
|
429
431
|
|
@@ -638,6 +640,8 @@ class Gchart
|
|
638
640
|
set_title unless title.nil?
|
639
641
|
when '@legend'
|
640
642
|
set_legend unless legend.nil?
|
643
|
+
when '@labels'
|
644
|
+
set_labels unless labels.nil?
|
641
645
|
when '@thickness'
|
642
646
|
set_line_thickness
|
643
647
|
when '@new_markers'
|
data/lib/gchart/aliases.rb
CHANGED
@@ -8,7 +8,6 @@ class Gchart
|
|
8
8
|
alias_method :line_colors=, :bar_colors=
|
9
9
|
alias_method :line_color=, :bar_colors=
|
10
10
|
alias_method :slice_colors=, :bar_colors=
|
11
|
-
alias_method :labels=, :legend=
|
12
11
|
alias_method :horizontal?, :horizontal
|
13
12
|
alias_method :grouped?, :grouped
|
14
13
|
alias_method :curved?, :curved
|
data/lib/gchart/version.rb
CHANGED
data/spec/gchart_spec.rb
CHANGED
@@ -178,7 +178,12 @@ describe "generating a default Gchart" do
|
|
178
178
|
url = Gchart.line(:data => data, :axis_with_labels => 'x,y', :axis_labels => [((1..24).to_a << 1)], :max_value => 700)
|
179
179
|
url.should include('chxr=0,85,700')
|
180
180
|
end
|
181
|
-
|
181
|
+
|
182
|
+
it 'should generate different labels and legend' do
|
183
|
+
Gchart.line(:legend => %w(1 2 3), :labels=>%w(one two three)).should(include('chdl=1|2|3'))
|
184
|
+
Gchart.line(:legend => %w(1 2 3), :labels=>%w(one two three)).should(include('chl=one|two|three'))
|
185
|
+
end
|
186
|
+
|
182
187
|
end
|
183
188
|
|
184
189
|
describe "generating different type of charts" do
|
metadata
CHANGED
@@ -1,13 +1,12 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googlecharts
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash: 13
|
5
4
|
prerelease: false
|
6
5
|
segments:
|
7
6
|
- 1
|
8
7
|
- 6
|
9
|
-
-
|
10
|
-
version: 1.6.
|
8
|
+
- 2
|
9
|
+
version: 1.6.2
|
11
10
|
platform: ruby
|
12
11
|
authors:
|
13
12
|
- Matt Aimonetti
|
@@ -15,7 +14,7 @@ autorequire:
|
|
15
14
|
bindir: bin
|
16
15
|
cert_chain: []
|
17
16
|
|
18
|
-
date: 2011-
|
17
|
+
date: 2011-04-13 00:00:00 -07:00
|
19
18
|
default_executable:
|
20
19
|
dependencies: []
|
21
20
|
|
@@ -40,6 +39,7 @@ files:
|
|
40
39
|
- VERSION
|
41
40
|
- config/hoe.rb
|
42
41
|
- config/requirements.rb
|
42
|
+
- googlecharts.gemspec
|
43
43
|
- lib/gchart.rb
|
44
44
|
- lib/gchart/aliases.rb
|
45
45
|
- lib/gchart/theme.rb
|
@@ -78,7 +78,6 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
79
79
|
- - ">="
|
80
80
|
- !ruby/object:Gem::Version
|
81
|
-
hash: 3
|
82
81
|
segments:
|
83
82
|
- 0
|
84
83
|
version: "0"
|
@@ -87,7 +86,6 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
87
86
|
requirements:
|
88
87
|
- - ">="
|
89
88
|
- !ruby/object:Gem::Version
|
90
|
-
hash: 3
|
91
89
|
segments:
|
92
90
|
- 0
|
93
91
|
version: "0"
|