Class: MotionPlot::Style
- Inherits:
-
Object
- Object
- MotionPlot::Style
- 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
-
#alignment ⇒ Object
Returns the value of attribute alignment.
-
#color ⇒ Object
Returns the value of attribute color.
-
#font_name ⇒ Object
Returns the value of attribute font_name.
-
#font_size ⇒ Object
Returns the value of attribute font_size.
-
#gradient ⇒ Object
Returns the value of attribute gradient.
-
#offset ⇒ Object
Returns the value of attribute offset.
-
#padding ⇒ Object
Returns the value of attribute padding.
-
#plot_area ⇒ Object
Returns the value of attribute plot_area.
-
#rotation ⇒ Object
Returns the value of attribute rotation.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#initialize(args = {}) ⇒ Style
constructor
A new instance of Style.
- #paddings_for(graph) ⇒ Object
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={}) = DEFAULTS.merge(args) .each_pair {|key, value| send("#{key}=", value) if(respond_to?("#{key}=")) } @plot_area = PlotArea.new(args[:plot_area] || {}) end |
Instance Attribute Details
#alignment ⇒ Object
Returns the value of attribute alignment.
3 4 5 |
# File 'lib/motion-plot/utilities/style.rb', line 3 def alignment @alignment end |
#color ⇒ Object
Returns the value of attribute color.
3 4 5 |
# File 'lib/motion-plot/utilities/style.rb', line 3 def color @color end |
#font_name ⇒ Object
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_size ⇒ Object
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 |
#gradient ⇒ Object
Returns the value of attribute gradient.
3 4 5 |
# File 'lib/motion-plot/utilities/style.rb', line 3 def gradient @gradient end |
#offset ⇒ Object
Returns the value of attribute offset.
3 4 5 |
# File 'lib/motion-plot/utilities/style.rb', line 3 def offset @offset end |
#padding ⇒ Object
Returns the value of attribute padding.
3 4 5 |
# File 'lib/motion-plot/utilities/style.rb', line 3 def padding @padding end |
#plot_area ⇒ Object
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 |
#rotation ⇒ Object
Returns the value of attribute rotation.
3 4 5 |
# File 'lib/motion-plot/utilities/style.rb', line 3 def rotation @rotation end |
#width ⇒ Object
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 |