lib/gruff/stacked_area.rb in topfunky-gruff-0.3.2 vs lib/gruff/stacked_area.rb in topfunky-gruff-0.3.3
- old
+ new
@@ -5,10 +5,11 @@
class Gruff::StackedArea < Gruff::Base
include StackedMixin
attr_accessor :last_series_goes_on_bottom
def draw
+ get_maximum_by_stack
super
return unless @has_data
@x_increment = @graph_width / (@column_count - 1).to_f
@@ -22,10 +23,10 @@
prev_data_points = data_points
data_points = Array.new
@d = @d.fill data_row[DATA_COLOR_INDEX]
- data_row[1].each_with_index do |data_point, index|
+ data_row[DATA_VALUES_INDEX].each_with_index do |data_point, index|
# Use incremented x and scaled y
new_x = @graph_left + (@x_increment * index)
new_y = @graph_top + (@graph_height - data_point * @graph_height - height[index])
height[index] += (data_point * @graph_height)