ghazel-googlecharts 1.4.0 → 1.4.0.1
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/lib/gchart.rb +17 -2
- metadata +1 -1
data/lib/gchart.rb
CHANGED
@@ -152,8 +152,23 @@ class Gchart
|
|
152
152
|
ax[1] = @max_value.nil? ? [ax[0], cmds.max].compact.max : @max_value
|
153
153
|
end
|
154
154
|
else
|
155
|
-
@
|
156
|
-
|
155
|
+
if @type == :bar and not grouped
|
156
|
+
@min_value = ds.compact.first.compact.min if @min_value.nil?
|
157
|
+
if @max_value.nil?
|
158
|
+
totals = []
|
159
|
+
ds.compact.each do |mds|
|
160
|
+
mds.each_with_index do |v, index|
|
161
|
+
next if v.nil?
|
162
|
+
totals[index] ||= 0
|
163
|
+
totals[index] += v
|
164
|
+
end
|
165
|
+
end
|
166
|
+
@max_value = totals.compact.max
|
167
|
+
end
|
168
|
+
else
|
169
|
+
@min_value = ds.compact.map{|mds| mds.compact.min}.min if @min_value.nil?
|
170
|
+
@max_value = ds.compact.map{|mds| mds.compact.max}.max if @max_value.nil?
|
171
|
+
end
|
157
172
|
@axis << [@min_value, @max_value]
|
158
173
|
end
|
159
174
|
|