Class Scruffy::Layers::Stacked
In: lib/scruffy/layers/stacked.rb
Parent: Base

Scruffy::Layers::Stacked

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).

Methods

legend_data   new   points   points=   render   top_value  

Included Modules

Scruffy::Helpers::LayerContainer

Public Class methods

Returns new Stacked graph.

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.

Public Instance methods

A stacked graph has many data sets. Return legend information for all of them.

Overrides Base#render to fiddle with layers’ points to achieve a stacked effect.

The highest data point on this layer, or nil if relevant_data == false

[Validate]