Class: RubyPost::LinePlot
- Inherits:
-
AbstractPlot
- Object
- Object
- BaseDrawCommand
- AbstractPlot
- RubyPost::LinePlot
- Defined in:
- lib/simpleplot.rb
Instance Attribute Summary
Attributes inherited from AbstractPlot
Attributes inherited from BaseDrawCommand
Instance Method Summary collapse
- #compile ⇒ Object
- #compilewithscale(xscale, yscale) ⇒ Object
-
#initialize(x, y) ⇒ LinePlot
constructor
Intitalise with two arrays of the same size.
Methods inherited from AbstractPlot
Methods inherited from BaseDrawCommand
#add_option, #color, #colour, #compile_options, #rotate, #scale, #set_drawable, #translate
Constructor Details
#initialize(x, y) ⇒ LinePlot
Intitalise with two arrays of the same size.
136 137 138 139 140 |
# File 'lib/simpleplot.rb', line 136 def initialize(x, y) super() @x = x @y = y end |
Instance Method Details
#compile ⇒ Object
142 143 144 145 146 |
# File 'lib/simpleplot.rb', line 142 def compile @p = Path.new @x.each_index{ |i| @p.add_pair(Pair.new(@x[i].cm, @y[i].cm)) } 'draw ' + @p.compile + ' ' + + ";\n" end |
#compilewithscale(xscale, yscale) ⇒ Object
148 149 150 151 152 |
# File 'lib/simpleplot.rb', line 148 def compilewithscale(xscale, yscale) @p = Path.new @x.each_index{ |i| @p.add_pair(Pair.new((@x[i]*xscale).cm, (@y[i]*yscale).cm)) } 'draw ' + @p.compile + ' ' + + ";\n" end |