Sha256: bd2df49629b1c2669fe68e4e2c75226d7e28801a7196d05420b71553bc441cae

Contents?: true

Size: 772 Bytes

Versions: 16

Compression:

Stored size: 772 Bytes

Contents

# frozen_string_literal: true

# @private
module Gruff::Base::BarMixin
  def normalized_group_bars
    @normalized_group_bars ||= begin
      group_bars = Array.new(column_count) { [] }
      store.norm_data.each_with_index do |data_row, row_index|
        data_row.points.each_with_index do |data_point, point_index|
          group_bars[point_index] << BarData.new(data_point, store.data[row_index].points[point_index], data_row.color)
        end

        # Adjust the number of each group with empty bar
        (data_row.points.size..(column_count - 1)).each do |index|
          group_bars[index] << BarData.new(0, nil, data_row.color)
        end
      end
      group_bars
    end
  end

  # @private
  class BarData < Struct.new(:point, :value, :color)
  end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
gruff-0.24.0-java lib/gruff/helper/bar_mixin.rb
gruff-0.24.0 lib/gruff/helper/bar_mixin.rb
gruff-0.23.0 lib/gruff/helper/bar_mixin.rb
gruff-0.23.0-java lib/gruff/helper/bar_mixin.rb
gruff-0.22.0 lib/gruff/helper/bar_mixin.rb
gruff-0.22.0-java lib/gruff/helper/bar_mixin.rb
gruff-0.21.0-java lib/gruff/helper/bar_mixin.rb
gruff-0.21.0 lib/gruff/helper/bar_mixin.rb
gruff-0.20.0-java lib/gruff/helper/bar_mixin.rb
gruff-0.20.0 lib/gruff/helper/bar_mixin.rb
gruff-0.19.0 lib/gruff/helper/bar_mixin.rb
gruff-0.19.0-java lib/gruff/helper/bar_mixin.rb
gruff-0.18.0-java lib/gruff/helper/bar_mixin.rb
gruff-0.18.0 lib/gruff/helper/bar_mixin.rb
gruff-0.17.0-java lib/gruff/helper/bar_mixin.rb
gruff-0.17.0 lib/gruff/helper/bar_mixin.rb