Sha256: d7e6136956b1ac4f9f69bb3c25a3708aedb9095f90d8d9d59ef87f4ff13c12f8

Contents?: true

Size: 565 Bytes

Versions: 4

Compression:

Stored size: 565 Bytes

Contents

# frozen_string_literal: true

# @private
module Gruff::Base::StackedMixin
  # Used by StackedBar and child classes.
  #
  # tsal: moved from Base 03 FEB 2007
  def calculate_maximum_by_stack
    # Get sum of each stack
    max_hash = Hash.new { |h, k| h[k] = 0.0 }
    store.data.each do |data_set|
      data_set.points.each_with_index do |data_point, i|
        max_hash[i] += data_point.to_f
      end
    end

    max_hash.each_key do |key|
      self.maximum_value = max_hash[key] if max_hash[key] > maximum_value
    end
    self.minimum_value = 0
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
gruff-0.15.0-java lib/gruff/helper/stacked_mixin.rb
gruff-0.15.0 lib/gruff/helper/stacked_mixin.rb
gruff-0.14.0 lib/gruff/helper/stacked_mixin.rb
gruff-0.14.0-java lib/gruff/helper/stacked_mixin.rb