Class Scruffy::Layers::Stacked
In: lib/scruffy/layers/stacked.rb
Parent: Base
Graph Pie Stacked Base ValueMarkers Legend Label Graphs Title Grid Background DataMarkers StyleInfo Viewport Base Empty Standard Cubed3d Cubed Split Pie Sparkline Reversed StandardError RenderError Base AllSmiles Area SparklineBar PieSlice Average Scatter Bar Line Base Number Percentage Currency Custom Base Tulips Vitamins CareBears Apples RubyBlog Mephisto Keynote GraphState BatikRasterizer RMagickRasterizer Components Rasterizers Renderers LayerContainer Hash Array PointContainer Canvas Helpers VERSION Layers Formatters Themes Scruffy dot/f_4.png

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  

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.

TODO, special points accessor

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

[Validate]