Well, it seems I forgot to add the acts_as_authenticated to the repository on my...
[selectricity-live] / vendor / plugins / gruff / lib / gruff / accumulator_bar.rb
1 require File.dirname(__FILE__) + '/base'
2
3 ##
4 # A special bar graph that shows a single dataset as a set of
5 # stacked bars. The bottom bar shows the running total and 
6 # the top bar shows the new value being added to the array.
7
8 class Gruff::AccumulatorBar < Gruff::StackedBar
9
10   def draw
11     raise(Gruff::IncorrectNumberOfDatasetsException) unless @data.length == 1
12     
13     accumulator_array = []
14     index = 0
15
16     increment_array = @data.first[DATA_VALUES_INDEX].inject([]) {|memo, value| 
17         memo << ((index > 0) ? (value + memo.max) : value)
18         accumulator_array << memo[index] - value
19         index += 1
20         memo
21       }
22     data "Accumulator", accumulator_array
23     
24     super
25   end
26
27 end

Benjamin Mako Hill || Want to submit a patch?