Permalink
Browse files

Using DATA_VALUES_INDEX properly where its value was hard-coded.

  • Loading branch information...
1 parent 4de512c commit a3e94701e38db01a9d1faff7386137ba43c44572 @jcoglan jcoglan committed Aug 10, 2008
Showing with 3 additions and 3 deletions.
  1. +3 −3 lib/gruff/base.rb
View
@@ -941,7 +941,7 @@ def significant(inc) # :nodoc:
# Sort with largest overall summed value at front of array so it shows up
# correctly in the drawn graph.
def sort_norm_data
- @norm_data.sort! { |a,b| sums(b[1]) <=> sums(a[1]) }
+ @norm_data.sort! { |a,b| sums(b[DATA_VALUES_INDEX]) <=> sums(a[DATA_VALUES_INDEX]) }
end
def sums(data_set) # :nodoc:
@@ -973,10 +973,10 @@ def get_maximum_by_stack
def make_stacked # :nodoc:
stacked_values = Array.new(@column_count, 0)
@data.each do |value_set|
- value_set[1].each_with_index do |value, index|
+ value_set[DATA_VALUES_INDEX].each_with_index do |value, index|
stacked_values[index] += value
end
- value_set[1] = stacked_values.dup
+ value_set[DATA_VALUES_INDEX] = stacked_values.dup
end
end

0 comments on commit a3e9470

Please sign in to comment.