| Class | Scruffy::Layers::Stacked |
| In: |
lib/scruffy/layers/stacked.rb
|
| Parent: | Base |
| Author: | Brasten Sager |
| Date: | August 12th, 2006 |
Provides a generic way for stacking graphs. This may or may not do what you‘d expect under every situation, but it at least kills a couple birds with one stone (stacked bar graphs and stacked area graphs work fine).
You can provide a block for easily adding layers during (just after) initialization. Example:
Stacked.new do |stacked|
stacked << Scruffy::Layers::Line.new( ... )
stacked.add(:bar, 'My Bar', [...])
end
The initialize method passes itself to the block, and since stacked is a LayerContainer, layers can be added just as if they were being added to Graph.
Overrides Base#render to fiddle with layers’ points to achieve a stacked effect.