rbgct 0.0.4 → 0.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/CONTRIBUTORS CHANGED
@@ -1,2 +1,3 @@
1
1
  This library is inspired by SEER.
2
- Thanks to the author Corey Ehmke and to the contributors Alexey Kuleshov, Harold Giménez, Henry Poydar
2
+ Thanks to the author Corey Ehmke and to the contributors Alexey Kuleshov, Harold Giménez, Henry Poydar.
3
+ AND Christopher Hill!!!
@@ -6,7 +6,7 @@ module Rbgct::Charts
6
6
  DEFAULT_HEIGHT = 400
7
7
 
8
8
  attr_accessor :data, :type
9
- attr_accessor :width, :height, :dom_id
9
+ attr_accessor :width, :height, :dom_id, :title, :h_title, :v_title, :top, :left, :legend, :x_strftime, :y_strftime
10
10
 
11
11
  def jsapi
12
12
  <<-EOL
@@ -31,7 +31,7 @@ module Rbgct::Charts
31
31
 
32
32
  // Create and draw the visualization.
33
33
  new google.visualization.LineChart(document.getElementById('#{dom_id}')).
34
- draw(data, {width: #{width}, height: #{height} #{options_for_chart}});
34
+ draw(data, {width: #{width}, height: #{height}, chartArea: {top: #{top}, left: #{left}} #{options_for_chart}});
35
35
  }
36
36
 
37
37
  google.setOnLoadCallback(drawVisualization);
@@ -51,6 +51,8 @@ module Rbgct::Charts
51
51
  @dom_id ||= 'visualization'
52
52
  @width ||= DEFAULT_WIDTH
53
53
  @height ||= DEFAULT_HEIGHT
54
+ @top ||= 'auto'
55
+ @left ||= 'auto'
54
56
  end
55
57
 
56
58
  end
@@ -40,12 +40,28 @@ module Rbgct::Charts
40
40
 
41
41
  def data_rows
42
42
  data.map do |row|
43
- %(data.addRow(['#{row.send(x_method)}', #{Array(row.send(y_method)).join(",")}]);)
43
+ %(data.addRow(['#{eval_x_strftime(row.send(x_method))}', #{Array(eval_y_strftime(row.send(y_method))).join(",")}]);)
44
44
  end.join("\n")
45
45
  end
46
46
 
47
47
  def options_for_chart
48
- ", vAxis: {maxValue: #{max_value}}, curveType: \"#{curve_type}\""
48
+ %(, vAxis: {maxValue: #{max_value}, title: "#{v_title}"}, hAxis: {title: "#{h_title}"}, curveType: "#{curve_type}")
49
+ end
50
+
51
+ def eval_x_strftime(val)
52
+ if respond_to?(:x_strftime) && x_strftime && val.respond_to?(:strftime)
53
+ val.send(:strftime, x_strftime)
54
+ else
55
+ val
56
+ end
57
+ end
58
+
59
+ def eval_y_strftime(val)
60
+ if respond_to?(:y_strftime) && y_strftime && val.respond_to?(:strftime)
61
+ val.send(:strftime, y_strftime)
62
+ else
63
+ val
64
+ end
49
65
  end
50
66
 
51
67
  def set_default_values_line_chart
data/lib/rbgct/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rbgct
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
metadata CHANGED
@@ -1,12 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rbgct
3
3
  version: !ruby/object:Gem::Version
4
- prerelease: false
5
- segments:
6
- - 0
7
- - 0
8
- - 4
9
- version: 0.0.4
4
+ prerelease:
5
+ version: 0.0.5
10
6
  platform: ruby
11
7
  authors:
12
8
  - Emanuele Tozzato
@@ -14,8 +10,7 @@ autorequire:
14
10
  bindir: bin
15
11
  cert_chain: []
16
12
 
17
- date: 2011-06-26 00:00:00 -07:00
18
- default_executable:
13
+ date: 2011-06-27 00:00:00 Z
19
14
  dependencies: []
20
15
 
21
16
  description: "Google Chart Tools provide a perfect way to visualize data on your website: now on Ruby"
@@ -41,7 +36,6 @@ files:
41
36
  - lib/rbgct/charts/line_chart.rb
42
37
  - lib/rbgct/version.rb
43
38
  - rbgct.gemspec
44
- has_rdoc: true
45
39
  homepage: http://www.mekdigital.com
46
40
  licenses: []
47
41
 
@@ -55,21 +49,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
55
49
  requirements:
56
50
  - - ">="
57
51
  - !ruby/object:Gem::Version
58
- segments:
59
- - 0
60
52
  version: "0"
61
53
  required_rubygems_version: !ruby/object:Gem::Requirement
62
54
  none: false
63
55
  requirements:
64
56
  - - ">="
65
57
  - !ruby/object:Gem::Version
66
- segments:
67
- - 0
68
58
  version: "0"
69
59
  requirements: []
70
60
 
71
61
  rubyforge_project: rbgct
72
- rubygems_version: 1.3.7
62
+ rubygems_version: 1.7.2
73
63
  signing_key:
74
64
  specification_version: 3
75
65
  summary: Ruby Google Chart Tools