Class: MotionPlot::Style

Inherits:
Object
  • Object
show all
Defined in:
lib/motion-plot/utilities/style.rb

Constant Summary collapse

DEFAULTS =
{
  font_name: "Helvetica",
  font_size: 10,
  offset: 10,
  color: "000000",
  padding: [5.0, 10.0, 5.0, 10.0]
}

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ Style

Returns a new instance of Style.



13
14
15
16
17
18
19
20
21
# File 'lib/motion-plot/utilities/style.rb', line 13

def initialize(args={})
  options = DEFAULTS.merge(args)

  options.each_pair {|key, value|
    send("#{key}=", value) if(respond_to?("#{key}="))
  }

  @plot_area = PlotArea.new(args[:plot_area] || {})
end

Instance Attribute Details

#alignmentObject

Returns the value of attribute alignment.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def alignment
  @alignment
end

#colorObject

Returns the value of attribute color.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def color
  @color
end

#font_nameObject

Returns the value of attribute font_name.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def font_name
  @font_name
end

#font_sizeObject

Returns the value of attribute font_size.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def font_size
  @font_size
end

#gradientObject

Returns the value of attribute gradient.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def gradient
  @gradient
end

#offsetObject

Returns the value of attribute offset.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def offset
  @offset
end

#paddingObject

Returns the value of attribute padding.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def padding
  @padding
end

#plot_areaObject

Returns the value of attribute plot_area.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def plot_area
  @plot_area
end

#rotationObject

Returns the value of attribute rotation.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def rotation
  @rotation
end

#widthObject

Returns the value of attribute width.



3
4
5
# File 'lib/motion-plot/utilities/style.rb', line 3

def width
  @width
end

Instance Method Details

#paddings_for(graph) ⇒ Object



23
24
25
26
27
# File 'lib/motion-plot/utilities/style.rb', line 23

def paddings_for(graph)
  %W(left top right bottom).each_with_index do |pos, index|
    graph.send("padding#{pos.camelize}=", @padding[index]) unless(padding[index].nil?)
  end
end