Class DataPoint
In: lib/SVG/Graph/DataPoint.rb
Parent: Object

Methods

Constants

OVERLAY = "OVERLAY" unless defined?(OVERLAY)
DEFAULT_SHAPE = lambda{|x,y,line| ["circle", { "cx" => x, "cy" => y, "r" => "2.5", "class" => "dataPoint#{line}"
CRITERIA = [] unless defined? CRITERIA

Public Class methods

[Source]

    # File lib/SVG/Graph/DataPoint.rb, line 11
11:   def DataPoint.configure_shape_criteria(*matchers)
12:     CRITERIA.push(*matchers)
13:   end

[Source]

    # File lib/SVG/Graph/DataPoint.rb, line 18
18:   def initialize(x, y, line)
19:     @x = x
20:     @y = y
21:     @line = line
22:   end

[Source]

    # File lib/SVG/Graph/DataPoint.rb, line 14
14:   def DataPoint.reset_shape_criteria
15:     CRITERIA.clear
16:   end

Public Instance methods

[Source]

    # File lib/SVG/Graph/DataPoint.rb, line 23
23:   def shape(description=nil)
24:     shapes = CRITERIA.select {|criteria|
25:       criteria.size == 2
26:     }.collect {|regexp, proc|
27:       proc.call(@x, @y, @line) if description =~ regexp
28:     }.compact
29:     shapes = [DEFAULT_SHAPE.call(@x, @y, @line)] if shapes.empty?
30: 
31:     overlays = CRITERIA.select { |criteria|
32:       criteria.last == OVERLAY
33:     }.collect { |regexp, proc|
34:       proc.call(@x, @y, @line) if description =~ regexp
35:     }.compact
36: 
37:     return shapes + overlays
38:   end

[Validate]