Method: Bio::Graphics::Ruler#initialize

Defined in:
lib/bio/graphics/ruler.rb

#initialize(panel, colour = [0,0,0]) ⇒ Ruler

Creates a new Bio::Graphics::Ruler object.


Arguments:

  • panel (required)

    Bio::Graphics::Panel object that this ruler

    belongs to

  • colour

    colour of the ruler. Default = ‘black’

Returns

Bio::Graphics::Ruler object



27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/bio/graphics/ruler.rb', line 27

def initialize(panel, colour = [0,0,0])
  @panel = panel
  @name = 'ruler'
  @colour = colour
  
  # Number of pixels between each tick, used to calculate tick spacing
  @min_pixels_per_tick = 5
  # The base height of minor ticks in pixels
  @tick_height = 5
  # The height of the text in pixels
  @tick_text_height = 10

  @minor_tick_distance = @min_pixels_per_tick ** self.scaling_factor
  @major_tick_distance = @minor_tick_distance * 10       
end