Sha256: 655e00d694b3717fe1e5c50a772d8b3e3920655e519298eb96a184404001262a

Contents?: true

Size: 550 Bytes

Versions: 11

Compression:

Stored size: 550 Bytes

Contents

require File.dirname(__FILE__) + '/base'

##
# A special bar graph that shows a single dataset as a set of
# stacked bars. The bottom bar shows the running total and 
# the top bar shows the new value being added to the array.

class Gruff::AccumulatorBar < Gruff::StackedBar
  def draw
    raise(Gruff::IncorrectNumberOfDatasetsException) unless @data.length == 1

    accum_array = @data.first[DATA_VALUES_INDEX][0..-2].inject([0]) { |a, v| a << a.last + v}
    data 'Accumulator', accum_array
    set_colors
    @data.reverse!
    super
  end
end

Version data entries

11 entries across 11 versions & 2 rubygems

Version Path
mdg-1.0.1 vendor/bundle/ruby/2.3.0/gems/gruff-0.7.0/lib/gruff/accumulator_bar.rb
gruff-0.7.0-java lib/gruff/accumulator_bar.rb
gruff-0.7.0 lib/gruff/accumulator_bar.rb
gruff-0.6.0-java lib/gruff/accumulator_bar.rb
gruff-0.6.0 lib/gruff/accumulator_bar.rb
gruff-0.5.1-java lib/gruff/accumulator_bar.rb
gruff-0.5.1 lib/gruff/accumulator_bar.rb
gruff-0.5.0-java lib/gruff/accumulator_bar.rb
gruff-0.5.0 lib/gruff/accumulator_bar.rb
gruff-0.4.0 lib/gruff/accumulator_bar.rb
gruff-0.4.0-java lib/gruff/accumulator_bar.rb