module ImageParadise::Gruff::Base::StackedMixin

Constants

DATA_VALUES_INDEX

Used by StackedBar and child classes.

tsal: moved from Base 03 FEB 2007

Public Instance Methods

get_maximum_by_stack() click to toggle source

get_maximum_by_stack

# File lib/image_paradise/graphs/stacked_mixin.rb, line 13
def get_maximum_by_stack
  # Get sum of each stack
  max_hash = {}
  @data.each { |data_set|
    data_set[DATA_VALUES_INDEX].each_with_index do |data_point, i|
      max_hash[i] = 0.0 unless max_hash[i]
      max_hash[i] += data_point.to_f
    end
  }

  # @maximum_value = 0
  max_hash.keys.each { |key|
    @maximum_value = max_hash[key] if max_hash[key] > @maximum_value
  }
  @minimum_value = 0
end