Class: Rust::Plots::Axis

Inherits:
Renderable show all
Defined in:
lib/rust/plots/core.rb

Overview

Represents an axis for a plot.

Constant Summary collapse

BELOW =
1
LEFT =
2
ABOVE =
3
RIGHT =
4

Instance Method Summary collapse

Methods inherited from Renderable

#[]=

Constructor Details

#initialize(side) ⇒ Axis

Creates a new axis at the given side (constants BELOW, LEFT, ABOVE, and RIGHT are available).



224
225
226
227
228
229
230
# File 'lib/rust/plots/core.rb', line 224

def initialize(side)
    super()
    
    self['side'] = side
    self.at(nil)
    self.labels(true)
end

Instance Method Details

#_renderObject



256
257
258
259
260
261
262
263
# File 'lib/rust/plots/core.rb', line 256

def _render()
    function = Rust::Function.new("axis")
    function.options = @options
    
    function.call
    
    return self
end

#at(values) ⇒ Object



232
233
234
235
236
# File 'lib/rust/plots/core.rb', line 232

def at(values)
    self['at'] = values
    
    return self
end

#horizontal_labelsObject



244
245
246
247
248
# File 'lib/rust/plots/core.rb', line 244

def horizontal_labels
    self['las'] = 1
    
    return self
end

#labels(value) ⇒ Object



250
251
252
253
254
# File 'lib/rust/plots/core.rb', line 250

def labels(value)
    self['labels'] = value
    
    return self
end

#vertical_labelsObject



238
239
240
241
242
# File 'lib/rust/plots/core.rb', line 238

def vertical_labels
    self['las'] = 2
    
    return self
end