scruffy 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/CHANGES CHANGED
@@ -1,5 +1,15 @@
1
1
  = Scruffy Changelog
2
2
 
3
+ == Version 0.2.2
4
+ (August 19th, 2006)
5
+
6
+ * Removed all font-family and text-rendering attributes from elements.
7
+ - These were causing issues with Batik and Adobe Viewer. Horrible font problems.
8
+ * Added require 'builder' to renderers/base.rb
9
+ * Added minor shadows to most graph types. Adds some depth perception.
10
+ * Added graph.layout as an alias of renderer. (graph.layout looks nicer).
11
+ * Added markers, values, grid options.
12
+
3
13
  == Version 0.2.1
4
14
  (August 18th, 2006)
5
15
 
@@ -4,28 +4,32 @@ module Scruffy
4
4
  attr_reader :id
5
5
 
6
6
  # In terms of percentages: [10, 10] == 10% by 10%
7
- attr_reader :position
8
- attr_reader :size
9
- attr_reader :options
7
+ attr_accessor :position
8
+ attr_accessor :size
9
+ attr_accessor :options
10
+ attr_accessor :visible
10
11
 
11
12
  def initialize(id, options = {})
12
13
  @id = id.to_sym
13
- @position = options[:position]
14
- @size = options[:size]
14
+ @position = options[:position] || [0, 0]
15
+ @size = options[:size] || [100, 100]
16
+ @visible = options[:visible] || true
15
17
  @options = options
16
18
  end
17
19
 
18
20
  def render(svg, bounds, options={})
19
- unless bounds.nil?
20
- @render_height = bounds[:height]
21
+ if @visible
22
+ unless bounds.nil?
23
+ @render_height = bounds[:height]
21
24
 
22
- svg.g(:id => id.to_s,
23
- :transform => "translate(#{bounds.delete(:x)}, #{bounds.delete(:y)})") {
25
+ svg.g(:id => id.to_s,
26
+ :transform => "translate(#{bounds.delete(:x)}, #{bounds.delete(:y)})") {
24
27
 
25
- draw(svg, bounds, options.merge(@options))
26
- }
27
- else
28
- process(svg, options.merge(@options))
28
+ draw(svg, bounds, options.merge(@options))
29
+ }
30
+ else
31
+ process(svg, options.merge(@options))
32
+ end
29
33
  end
30
34
  end
31
35
 
@@ -12,9 +12,7 @@ module Scruffy
12
12
  svg.text(options[:point_markers][idx], :x => x_coord, :y => bounds[:height],
13
13
  'font-size' => relative(90),
14
14
  :fill => (options[:theme].marker || 'white').to_s,
15
- 'text-anchor' => 'middle',
16
- 'font-family' => options[:theme].font_family,
17
- 'text-rendering' => 'optimizeLegibility') unless options[:point_markers][idx].nil?
15
+ 'text-anchor' => 'middle') unless options[:point_markers][idx].nil?
18
16
  end
19
17
  end
20
18
  end # draw
@@ -1,8 +1,10 @@
1
1
  module Scruffy
2
2
  module Components
3
3
  class Grid < Base
4
+ attr_accessor :markers
5
+
4
6
  def draw(svg, bounds, options={})
5
- markers = options[:markers] || 5
7
+ markers = (options[:markers] || self.markers) || 5
6
8
 
7
9
  (0...markers).each do |idx|
8
10
  marker = ((1 / (markers - 1).to_f) * idx) * bounds[:height]
@@ -4,8 +4,7 @@ module Scruffy
4
4
  def draw(svg, bounds, options={})
5
5
  svg.text(@options[:text], :class => 'text', :x => (bounds[:width] / 2), :y => bounds[:height],
6
6
  'font-size' => relative(100), :fill => options[:theme].marker, :stroke => 'none', 'stroke-width' => '0',
7
- 'text-anchor' => (@options[:text_anchor] || 'middle'),
8
- 'font-family' => options[:theme].font_family, 'text-rendering' => 'optimizeLegibility')
7
+ 'text-anchor' => (@options[:text_anchor] || 'middle'))
9
8
  end
10
9
  end
11
10
  end
@@ -20,9 +20,7 @@ module Scruffy::Components
20
20
  :x => offset + point + relative(100),
21
21
  :y => relative(80),
22
22
  'font-size' => relative(80),
23
- :fill => (options[:theme].marker || 'white'),
24
- 'font-family' => options[:theme].font_family,
25
- 'text-rendering' => 'optimizeLegibility')
23
+ :fill => (options[:theme].marker || 'white'))
26
24
  end
27
25
  end # draw
28
26
 
@@ -5,6 +5,11 @@ module Scruffy
5
5
  # In hindsight, ImageMagick and Mozilla SVG's handling of CSS styling is
6
6
  # extremely inconsistant, so use this at your own risk.
7
7
  class StyleInfo < Base
8
+ def initialize(*args)
9
+ super
10
+
11
+ @visible = false
12
+ end
8
13
  def process(svg, options={})
9
14
  svg.defs {
10
15
  svg.style(:type => "text/css") {
@@ -4,8 +4,7 @@ module Scruffy
4
4
  def draw(svg, bounds, options={})
5
5
  svg.text(options[:title], :class => 'title', :x => (bounds[:width] / 2), :y => bounds[:height],
6
6
  'font-size' => relative(100), :fill => options[:theme].marker, :stroke => 'none', 'stroke-width' => '0',
7
- 'text-anchor' => (@options[:text_anchor] || 'middle'),
8
- 'font-family' => options[:theme].font_family, 'text-rendering' => 'optimizeLegibility')
7
+ 'text-anchor' => (@options[:text_anchor] || 'middle'))
9
8
  end
10
9
  end
11
10
  end
@@ -1,8 +1,10 @@
1
1
  module Scruffy
2
2
  module Components
3
3
  class ValueMarkers < Base
4
+ attr_accessor :markers
5
+
4
6
  def draw(svg, bounds, options={})
5
- markers = options[:markers] || 5
7
+ markers = (options[:markers] || self.markers) || 5
6
8
  all_values = []
7
9
 
8
10
  (0...markers).each do |idx|
@@ -18,11 +20,9 @@ module Scruffy
18
20
  svg.text( marker_value.to_s,
19
21
  :x => bounds[:width],
20
22
  :y => (bounds[:height] - marker),
21
- 'font-size' => relative(10),
23
+ 'font-size' => relative(8),
22
24
  :fill => ((options.delete(:marker_color_override) || options[:theme].marker) || 'white').to_s,
23
- 'text-anchor' => 'end',
24
- 'font-family' => options[:theme].font_family,
25
- 'text-rendering' => 'optimizeLegibility')
25
+ 'text-anchor' => 'end')
26
26
  end
27
27
 
28
28
  end
@@ -3,8 +3,6 @@ module Scruffy::Components
3
3
  class Viewport < Base
4
4
  include Scruffy::Helpers::Canvas
5
5
 
6
- attr_accessor :components
7
-
8
6
  def initialize(*args, &block)
9
7
  super(*args)
10
8
 
@@ -46,6 +46,25 @@ module Scruffy::Formatters
46
46
  end
47
47
  end
48
48
 
49
+ # Allows you to pass in a Proc for use as a formatter.
50
+ #
51
+ # Use:
52
+ #
53
+ # graph.value_formatter = Scruffy::Formatters::Custom.new { |value, idx, options| "Displays Returned Value" }
54
+ class Custom < Base
55
+ attr_reader :proc
56
+
57
+ def initialize(&block)
58
+ self.proc = block
59
+ end
60
+
61
+ def format(target, idx, options)
62
+ proc.call(target, idx, options)
63
+ end
64
+ end
65
+
66
+
67
+
49
68
  # Default number formatter.
50
69
  # Limits precision, beautifies numbers.
51
70
  class Number < Base
data/lib/scruffy/graph.rb CHANGED
@@ -159,11 +159,20 @@ module Scruffy
159
159
  options[:as] ? rasterizer.rasterize(svg, options) : svg
160
160
  end
161
161
 
162
-
163
162
  def renderer=(val)
164
163
  raise ArgumentError, "Renderer must include a #render(options) method." unless (val.respond_to?(:render) && val.method(:render).arity.abs > 0)
165
164
 
166
165
  @renderer = val
167
166
  end
167
+
168
+ alias :layout :renderer
169
+
170
+ def component(id)
171
+ renderer.component(id)
172
+ end
173
+
174
+ def remove(id)
175
+ renderer.remove(id)
176
+ end
168
177
  end
169
178
  end
@@ -7,4 +7,5 @@
7
7
  module Scruffy::Helpers; end
8
8
 
9
9
  require 'scruffy/helpers/canvas'
10
- require 'scruffy/helpers/layer_container'
10
+ require 'scruffy/helpers/layer_container'
11
+ require 'scruffy/helpers/meta'
@@ -7,6 +7,20 @@ module Scruffy::Helpers
7
7
  # Provides common methods for canvas objects. Primarily used for providing spacial-type calculations
8
8
  # where necessary.
9
9
  module Canvas
10
+ attr_accessor :components
11
+
12
+ def reset_settings!
13
+ self.options = {}
14
+ end
15
+
16
+ def component(id, components=self.components)
17
+ components.find { |elem| elem.id == id }
18
+ end
19
+
20
+ def remove(id, components=self.components)
21
+ components.delete(component(id))
22
+ end
23
+
10
24
  protected
11
25
  # Converts percentage values into actual pixe values based on the known render size.
12
26
  #
@@ -1,4 +1,5 @@
1
1
  module Scruffy::Helpers
2
+
2
3
  # ==Scruffy::Helpers::LayerContainer
3
4
  #
4
5
  # Author:: Brasten Sager
@@ -8,10 +9,12 @@ module Scruffy::Helpers
8
9
  # container for graph layers. The best example of this is the Scruffy::Graph
9
10
  # object itself, but this module is also used by Scruffy::Layer::Stacked.
10
11
  module LayerContainer
11
- # Adds a Layer to the Graph/Container. Accepts either a list of arguments used to build a new layer, or
12
- # a Scruffy::Layers::Base-derived object. When passing a list of arguments, all arguments are optional, but the arguments
13
- # specified must be provided in a particular order: type (Symbol), title (String), points (Array),
14
- # options (Hash).
12
+
13
+ # Adds a Layer to the Graph/Container. Accepts either a list of
14
+ # arguments used to build a new layer, or a Scruffy::Layers::Base-derived
15
+ # object. When passing a list of arguments, all arguments are optional,
16
+ # but the arguments specified must be provided in a particular order:
17
+ # type (Symbol), title (String), points (Array), options (Hash).
15
18
  #
16
19
  # Both #add and #<< can be used.
17
20
  #
@@ -0,0 +1,5 @@
1
+ module Scruffy::MetaAttributes
2
+ def singleton_class
3
+ (class << self; self; end)
4
+ end
5
+ end
@@ -36,6 +36,9 @@ module Scruffy::Layers
36
36
  # }
37
37
  # }
38
38
  # }
39
+ svg.g(:transform => "translate(0, -#{relative(2)})") {
40
+ svg.polygon(:points => points_value, :style => "fill: black; stroke: black; fill-opacity: 0.06; stroke-opacity: 0.06;")
41
+ }
39
42
 
40
43
  svg.polygon(:points => points_value, :fill => color.to_s, :stroke => color.to_s, 'style' => "opacity: #{opacity}")
41
44
  end
@@ -12,6 +12,14 @@ module Scruffy::Layers
12
12
  coords.each do |coord|
13
13
  x, y, bar_height = (coord.first-(@bar_width * 0.5)), coord.last, (height - coord.last)
14
14
 
15
+ svg.g(:transform => "translate(-#{relative(0.5)}, -#{relative(0.5)})") {
16
+ svg.rect( :x => x, :y => y, :width => @bar_width + relative(1), :height => bar_height + relative(1),
17
+ :style => "fill: black; fill-opacity: 0.15; stroke: none;" )
18
+ svg.rect( :x => x+relative(0.5), :y => y+relative(2), :width => @bar_width + relative(1), :height => bar_height - relative(0.5),
19
+ :style => "fill: black; fill-opacity: 0.15; stroke: none;" )
20
+
21
+ }
22
+
15
23
  svg.rect( :x => x, :y => y, :width => @bar_width, :height => bar_height,
16
24
  :fill => color.to_s, 'style' => "opacity: #{opacity}; stroke: none;" )
17
25
  end
@@ -9,11 +9,21 @@ module Scruffy::Layers
9
9
 
10
10
  # Renders line graph.
11
11
  def draw(svg, coords, options={})
12
+ svg.g(:class => 'shadow', :transform => "translate(#{relative(0.5)}, #{relative(0.5)})") {
13
+ svg.polyline( :points => stringify_coords(coords).join(' '), :fill => 'transparent',
14
+ :stroke => 'black', 'stroke-width' => relative(2),
15
+ :style => 'fill-opacity: 0; stroke-opacity: 0.35' )
16
+
17
+ coords.each { |coord| svg.circle( :cx => coord.first, :cy => coord.last + relative(0.9), :r => relative(2),
18
+ :style => "stroke-width: #{relative(2)}; stroke: black; opacity: 0.35;" ) }
19
+ }
20
+
21
+
12
22
  svg.polyline( :points => stringify_coords(coords).join(' '), :fill => 'none',
13
23
  :stroke => color.to_s, 'stroke-width' => relative(2) )
14
24
 
15
- coords.each { |coord| svg.circle( :cx => coord.first, :cy => coord.last, :r => relative(2.5),
16
- :fill => color.to_s ) }
25
+ coords.each { |coord| svg.circle( :cx => coord.first, :cy => coord.last, :r => relative(2),
26
+ :style => "stroke-width: #{relative(2)}; stroke: #{color.to_s}; fill: #{color.to_s}" ) }
17
27
  end
18
28
  end
19
29
  end
@@ -1,3 +1,4 @@
1
+ require 'builder'
1
2
  module Scruffy::Renderers
2
3
  # ===Scruffy::Renderers::Base
3
4
  #
@@ -11,19 +12,29 @@ module Scruffy::Renderers
11
12
  class Base
12
13
  include Scruffy::Helpers::Canvas
13
14
 
14
- attr_accessor :components
15
+ attr_accessor :options
16
+
17
+ def initialize(options = {})
18
+ self.components = []
19
+ self.options = options
20
+ define_layout
21
+ end
15
22
 
16
23
  # Renders the graph and all components.
17
24
  def render(options = {})
18
25
  options[:graph_id] ||= 'scruffy_graph'
19
26
  options[:complexity] ||= (global_complexity || :normal)
20
27
 
28
+ # Allow subclasses to muck with components prior to renders.
29
+ rendertime_renderer = self.clone
30
+ rendertime_renderer.instance_eval { before_render if respond_to?(:before_render) }
31
+
21
32
  svg = Builder::XmlMarkup.new(:indent => 2)
22
33
  svg.instruct!
23
34
  svg.instruct! 'DOCTYPE', 'svg PUBLIC "-//W3C//DTD SVG 1.0//EN" "http://www.w3.org/TR/2001/REC-SVG-20010904/DTD/svg10.dtd" type'
24
35
  svg.svg(:xmlns => "http://www.w3.org/2000/svg", 'xmlns:xlink' => "http://www.w3.org/1999/xlink", :width => options[:size].first, :height => options[:size].last) {
25
36
  svg.g(:id => options[:graph_id]) {
26
- self.components.each do |component|
37
+ rendertime_renderer.components.each do |component|
27
38
  component.render(svg,
28
39
  bounds_for( options[:size], component.position, component.size ),
29
40
  options)
@@ -32,7 +43,42 @@ module Scruffy::Renderers
32
43
  }
33
44
  svg.target!
34
45
  end
35
-
46
+
47
+ def before_render
48
+ set_values(self.options[:values]) if (self.options[:values] && self.options[:values] != :hide)
49
+ hide_grid if (self.options[:grid] == :hide)
50
+ hide_values if (self.options[:values] == :hide)
51
+ hide_labels if (self.options[:labels] == :hide)
52
+ end
53
+
54
+ def method_missing(sym, *args)
55
+ self.options = {} if self.options.nil?
56
+
57
+ if args.size > 0
58
+ self.options[sym] = args[0]
59
+ else
60
+ return self.options[sym]
61
+ end
62
+ end
63
+
64
+ protected
65
+ def hide_grid
66
+ grids.each { |grid| grid.visible = false }
67
+ end
68
+
69
+ def set_values(val)
70
+ values.each { |value| value.markers = val }
71
+ grids.each { |grid| grid.markers = val }
72
+ end
73
+
74
+ def hide_values
75
+ values.each { |value| value.visible = false }
76
+ end
77
+
78
+ def hide_labels
79
+ labels.each { |label| label.visible = false }
80
+ end
81
+
36
82
  private
37
83
  def global_complexity
38
84
  if Kernel.const_defined? "SCRUFFY_COMPLEXITY"
@@ -41,5 +87,5 @@ module Scruffy::Renderers
41
87
  nil
42
88
  end
43
89
  end
44
- end
90
+ end # base
45
91
  end
@@ -13,7 +13,7 @@ module Scruffy::Renderers
13
13
  :bottom_right => [55, 65] }
14
14
 
15
15
  # Returns a Cubed instance.
16
- def initialize
16
+ def define_layout
17
17
  super do |components|
18
18
  components << Scruffy::Components::Title.new(:title, :position => [5, 2], :size => [90, 7])
19
19
 
@@ -13,7 +13,7 @@ module Scruffy::Renderers
13
13
  :bottom_right => [55, 65] }
14
14
 
15
15
  # Returns a Cubed instance.
16
- def initialize
16
+ def define_layout
17
17
  super do |components|
18
18
  components << Scruffy::Components::Title.new(:title, :position => [5, 2], :size => [90, 7])
19
19
 
@@ -13,11 +13,10 @@ module Scruffy::Renderers
13
13
  #
14
14
  # If a block is provided, the components array is passed to
15
15
  # the block, allowing callers to add components during initialize.
16
- def initialize
17
- self.components = []
16
+ def define_layout
18
17
  self.components << Scruffy::Components::Background.new(:background, :position => [0,0], :size =>[100, 100])
19
18
 
20
- yield(components) if block_given?
19
+ yield(self.components) if block_given?
21
20
  end
22
21
  end
23
22
  end
@@ -2,8 +2,7 @@ module Scruffy
2
2
  module Renderers
3
3
  class Reversed < Base
4
4
 
5
- def initialize
6
- self.components = []
5
+ def define_layout
7
6
  self.components << Scruffy::Components::Background.new(:background, :position => [0,0], :size =>[100, 100])
8
7
  self.components << Scruffy::Components::Title.new(:title, :position => [98, 95], :size => [1, 3], :text_anchor => 'end')
9
8
  #self.components << Scruffy::Components::Grid.new(:grid, :position => [14, 12], :size => [78.5, 70])
@@ -2,8 +2,7 @@ module Scruffy
2
2
  module Renderers
3
3
  # Experimental, do not use.
4
4
  class Sparkline < Base
5
- def initialize
6
- self.components = []
5
+ def define_layout
7
6
  self.components << Scruffy::Components::Graphs.new(:sparkline, :position => [0, 0], :size => [100, 100])
8
7
  end
9
8
  end
@@ -1,29 +1,43 @@
1
1
  module Scruffy
2
2
  module Renderers
3
3
  # Renderer that splits the graphs up into four other little graphs.
4
- class Split < Base
5
- def initialize(options = {})
6
- self.components = []
7
- self.components << Scruffy::Components::Background.new(:background, :position => [0,0], :size =>[100, 100])
8
- self.components << Scruffy::Components::Title.new(:title, :position => [5, 2], :size => [90, 7])
9
- self.components << Scruffy::Components::Label.new(:label_one, :text => options[:split_label] || '',
10
- :position => [30, 54.5], :size => [40, 3])
4
+ class Split < Empty
5
+ def define_layout
6
+ super do |components|
7
+ components << Scruffy::Components::Title.new(:title, :position => [5, 2], :size => [90, 7])
8
+ components << Scruffy::Components::Label.new(:label_one, :text => self.options[:split_label] || '',
9
+ :position => [30, 54.5], :size => [40, 3])
11
10
 
12
- # Viewports
13
- self.components << Scruffy::Components::Viewport.new(:top_left, :position => [3, 20],
14
- :size => [90, 30], &graph_block(:top))
15
- self.components << Scruffy::Components::Viewport.new(:top_left, :position => [3, 65],
16
- :size => [90, 30], &graph_block(:bottom))
11
+ # Viewports
12
+ components << Scruffy::Components::Viewport.new(:top, :position => [3, 20],
13
+ :size => [90, 30], &graph_block(:top))
14
+ components << Scruffy::Components::Viewport.new(:bottom, :position => [3, 65],
15
+ :size => [90, 30], &graph_block(:bottom))
17
16
 
18
- self.components << Scruffy::Components::Legend.new(:legend, :position => [5, 11], :size => [90, 4])
17
+ components << Scruffy::Components::Legend.new(:legend, :position => [5, 11], :size => [90, 4])
18
+ end
19
19
  end
20
20
 
21
+ protected
22
+ def labels
23
+ [component(:top).component(:labels), component(:bottom).component(:labels)]
24
+ end
25
+
26
+ def values
27
+ [component(:top).component(:values), component(:bottom).component(:values)]
28
+ end
29
+
30
+ def grids
31
+ [component(:top).component(:grid), component(:bottom).component(:grid)]
32
+ end
33
+
34
+
21
35
  private
22
36
  def graph_block(graph_filter)
23
37
  block = Proc.new { |components|
24
38
  components << Scruffy::Components::Grid.new(:grid, :position => [10, 0], :size => [90, 89])
25
- components << Scruffy::Components::ValueMarkers.new(:value_markers, :position => [0, 2], :size => [8, 89])
26
- components << Scruffy::Components::DataMarkers.new(:data_markers, :position => [10, 92], :size => [90, 8])
39
+ components << Scruffy::Components::ValueMarkers.new(:values, :position => [0, 2], :size => [8, 89])
40
+ components << Scruffy::Components::DataMarkers.new(:labels, :position => [10, 92], :size => [90, 8])
27
41
  components << Scruffy::Components::Graphs.new(:graphs, :position => [10, 0], :size => [90, 89], :only => graph_filter)
28
42
  }
29
43
 
@@ -1,20 +1,36 @@
1
- module Scruffy
2
- module Renderers
3
- class Standard < Base
4
-
5
- def initialize
6
- self.components = []
7
- self.components << Scruffy::Components::Background.new(:background, :position => [0,0], :size =>[100, 100])
8
- self.components << Scruffy::Components::Title.new(:title, :position => [5, 2], :size => [90, 7])
9
- self.components << Scruffy::Components::Viewport.new(:graph_viewport, :position => [2, 26], :size => [89, 66]) do |view|
10
- view << Scruffy::Components::Grid.new(:grid, :position => [20, 0], :size => [80, 90])
11
- view << Scruffy::Components::ValueMarkers.new(:value_markers, :position => [0, 2], :size => [17.5, 90])
12
- view << Scruffy::Components::DataMarkers.new(:data_markers, :position => [20, 94], :size => [80, 6])
13
- view << Scruffy::Components::Graphs.new(:graphs, :position => [20, 0], :size => [80, 90])
1
+ module Scruffy::Renderers
2
+ class Standard < Empty
3
+
4
+ def define_layout
5
+ super do |components|
6
+ components << Scruffy::Components::Title.new(:title, :position => [5, 2], :size => [90, 7])
7
+ components << Scruffy::Components::Viewport.new(:view, :position => [2, 26], :size => [89, 66]) do |graph|
8
+ graph << Scruffy::Components::ValueMarkers.new(:values, :position => [0, 2], :size => [18, 89])
9
+ graph << Scruffy::Components::Grid.new(:grid, :position => [20, 0], :size => [80, 89])
10
+ graph << Scruffy::Components::DataMarkers.new(:labels, :position => [20, 92], :size => [80, 8])
11
+ graph << Scruffy::Components::Graphs.new(:graphs, :position => [20, 0], :size => [80, 89])
14
12
  end
15
- self.components << Scruffy::Components::Legend.new(:legend, :position => [5, 13], :size => [90, 6])
13
+ components << Scruffy::Components::Legend.new(:legend, :position => [5, 13], :size => [90, 6])
16
14
  end
17
-
18
15
  end
16
+
17
+ protected
18
+ def hide_values
19
+ super
20
+ component(:view).position[0] = -10
21
+ component(:view).size[0] = 100
22
+ end
23
+
24
+ def labels
25
+ [component(:view).component(:labels)]
26
+ end
27
+
28
+ def values
29
+ [component(:view).component(:values)]
30
+ end
31
+
32
+ def grids
33
+ [component(:view).component(:grid)]
34
+ end
19
35
  end
20
36
  end
@@ -16,10 +16,10 @@ module Scruffy::Themes
16
16
  #
17
17
  # See Scruffy::Themes::Base#instantiate for examples.
18
18
  class Base
19
- attr_accessor :background
20
- attr_accessor :colors
21
- attr_accessor :marker
22
- attr_accessor :font_family
19
+ attr_accessor :background # Background color or array of two colors
20
+ attr_accessor :colors # Array of colors for data graphs
21
+ attr_accessor :marker # Marker color for grid lines, values, etc.
22
+ attr_accessor :font_family # Font family: Not really supported. Maybe in the future.
23
23
 
24
24
  # Returns a new Scruffy::Themes::Base object.
25
25
  #
@@ -28,7 +28,8 @@ module Scruffy::Themes
28
28
  # colors:: an array of color values to use for graphs.
29
29
  # marker:: color used for grid lines, values, data points, etc.
30
30
  # font_family:: in general, allows you to change the font used in the graph.
31
- # This is not yet supported in most graph elements.
31
+ # This is not yet supported in most graph elements,
32
+ # and may be deprecated soon anyway.
32
33
  def initialize(descriptor)
33
34
  self.background = descriptor[:background]
34
35
  self.colors = descriptor[:colors]
@@ -1,3 +1,3 @@
1
1
  module Scruffy
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.2'
3
3
  end
metadata CHANGED
@@ -3,8 +3,8 @@ rubygems_version: 0.9.0
3
3
  specification_version: 1
4
4
  name: scruffy
5
5
  version: !ruby/object:Gem::Version
6
- version: 0.2.1
7
- date: 2006-08-18 00:00:00 -07:00
6
+ version: 0.2.2
7
+ date: 2006-08-19 00:00:00 -07:00
8
8
  summary: A powerful, clean graphing library for Ruby.
9
9
  require_paths:
10
10
  - lib
@@ -56,6 +56,7 @@ files:
56
56
  - lib/scruffy/components/viewport.rb
57
57
  - lib/scruffy/helpers/canvas.rb
58
58
  - lib/scruffy/helpers/layer_container.rb
59
+ - lib/scruffy/helpers/meta.rb
59
60
  - lib/scruffy/layers/all_smiles.rb
60
61
  - lib/scruffy/layers/area.rb
61
62
  - lib/scruffy/layers/average.rb