lib/gruff/side_stacked_bar.rb in gruff-0.3.1 vs lib/gruff/side_stacked_bar.rb in gruff-0.3.3
- old
+ new
@@ -29,11 +29,11 @@
length = Array.new(@column_count, @graph_left)
@norm_data.each_with_index do |data_row, row_index|
@d = @d.fill data_row[DATA_COLOR_INDEX]
- data_row[1].each_with_index do |data_point, point_index|
+ data_row[DATA_VALUES_INDEX].each_with_index do |data_point, point_index|
## using the original calcs from the stacked bar chart to get the difference between
## part of the bart chart we wish to stack.
temp1 = @graph_left + (@graph_width -
data_point * @graph_width -
@@ -65,9 +65,9 @@
def larger_than_max?(data_point, index=0)
max(data_point, index) > @maximum_value
end
def max(data_point, index)
- @data.inject(0) {|sum, item| sum + item[1][index]}
+ @data.inject(0) {|sum, item| sum + item[DATA_VALUES_INDEX][index]}
end
end