Permalink
Browse files

fixed: extended encoding fails if the max value is zero [Graeme Stuart]

  • Loading branch information...
1 parent 799a787 commit be3736ce7b015cf1d0bd18e818f4405607710599 @mattetti mattetti committed Jul 20, 2009
Showing with 1 addition and 1 deletion.
  1. +1 −1 lib/gchart.rb
View
@@ -431,7 +431,7 @@ def convert_to_extended_value(number)
def extended_encoding
@max_value = dataset.compact.map{|ds| ds.compact.max}.max if @max_value == 'auto'
- if @max_value == false || @max_value == 'false' || @max_value == :false
+ if @max_value == false || @max_value == 'false' || @max_value == :false || @max_value == 0
"e:" + dataset.map { |ds| ds.map { |number| number.nil? ? '__' : convert_to_extended_value(number)}.join }.join(',')
else
"e:" + dataset.map { |ds| ds.map { |number| number.nil? ? '__' : convert_to_extended_value( (@@ext_pairs.size - 1) * number / @max_value) }.join }.join(',')

0 comments on commit be3736c

Please sign in to comment.