rbgct 0.0.8 → 0.0.9

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/init.rb CHANGED
@@ -1,4 +1,3 @@
1
1
  # encoding: UTF-8
2
-
3
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '.', 'lib'))
4
3
  require 'rbgct'
@@ -5,11 +5,13 @@ module Rbgct::Charts
5
5
  DEFAULT_WIDTH = 600
6
6
  DEFAULT_HEIGHT = 400
7
7
 
8
- attr_accessor :data, :type, :class_name
8
+ attr_accessor :data, :type, :class_name, :render_warning
9
9
  attr_accessor :width, :height, :dom_id, :title, :h_title, :v_title, :top, :left, :legend, :x_strftime, :y_strftime, :time_offset
10
-
11
-
10
+
12
11
  def render
12
+ if data.empty?
13
+ return render_warning ? "<span class='rbgct-no-data'>Dataset <em>#{title}<em> contains no data.</span>" : nil
14
+ end
13
15
  <<-EOL
14
16
  #{jsapi}
15
17
  #{draw_visualization_start}
@@ -61,12 +63,13 @@ module Rbgct::Charts
61
63
  end
62
64
 
63
65
  def set_default_values
64
- @dom_id ||= 'visualization'
65
- @width ||= DEFAULT_WIDTH
66
- @height ||= DEFAULT_HEIGHT
67
- @top ||= 100
68
- @left ||= 100
69
- @class_name ||= self.class.name.sub('Rbgct::Charts::','')
66
+ @render_warning ||= true
67
+ @dom_id ||= 'visualization'
68
+ @width ||= DEFAULT_WIDTH
69
+ @height ||= DEFAULT_HEIGHT
70
+ @top ||= 100
71
+ @left ||= 100
72
+ @class_name ||= self.class.name.sub('Rbgct::Charts::','')
70
73
  end
71
74
 
72
75
  end
@@ -9,6 +9,7 @@ module Rbgct::Charts
9
9
 
10
10
  def initialize(data, opts)
11
11
  raise ArgumentError.new('x_method or y_method are not defined') unless opts[:x_method] && opts[:y_method]
12
+ raise ArgumentError.new('dataset is not an Array') unless data.is_a?(Array)
12
13
 
13
14
  @data = data
14
15
 
@@ -8,6 +8,7 @@ module Rbgct::Charts
8
8
 
9
9
  def initialize(data, opts)
10
10
  raise ArgumentError.new('name or value are not defined') unless opts[:name] && opts[:value]
11
+ raise ArgumentError.new('dataset is not an Array') unless data.is_a?(Array)
11
12
 
12
13
  @data = data
13
14
 
data/lib/rbgct/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Rbgct
2
- VERSION = "0.0.8"
2
+ VERSION = "0.0.9"
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
- - 8
9
- version: 0.0.8
4
+ prerelease:
5
+ version: 0.0.9
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-30 00:00:00 -07:00
18
- default_executable:
13
+ date: 2011-07-01 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"
@@ -42,7 +37,6 @@ files:
42
37
  - lib/rbgct/charts/pie_chart.rb
43
38
  - lib/rbgct/version.rb
44
39
  - rbgct.gemspec
45
- has_rdoc: true
46
40
  homepage: http://www.mekdigital.com
47
41
  licenses: []
48
42
 
@@ -56,21 +50,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
56
50
  requirements:
57
51
  - - ">="
58
52
  - !ruby/object:Gem::Version
59
- segments:
60
- - 0
61
53
  version: "0"
62
54
  required_rubygems_version: !ruby/object:Gem::Requirement
63
55
  none: false
64
56
  requirements:
65
57
  - - ">="
66
58
  - !ruby/object:Gem::Version
67
- segments:
68
- - 0
69
59
  version: "0"
70
60
  requirements: []
71
61
 
72
62
  rubyforge_project: rbgct
73
- rubygems_version: 1.3.7
63
+ rubygems_version: 1.7.2
74
64
  signing_key:
75
65
  specification_version: 3
76
66
  summary: Ruby Google Chart Tools