Ortho > Documentation > Composite - orthoRuler

Ortho Documentation

Ortho Composite JavaScript Classes
  orthoRuler
   new orthoRuler(parent, left, top, rulertype, length [, options])
  parent: The parent Ortho object, typically a panel, in which the ruler will be placed
  left, top: The integer pixel coordinates within the panel that correspond to the TOP LEFT corner of the ruler
  rulertype: 'horizontal or 'vertical'
  length: The length in pixels of the ruler
  options: A hash of options for this object. These are particularly important for the orthoRuler object given the variety of ways in which ruler ticks and labels might be displayed. These options are listed in detail below.
 
  IMPORTANT: These option names may change in later releases as the ruler API matures and evolves to include arbitrary labels, logarithmic axes, etc. Caveat emptor
  major_tick_placement: Defines how the major ticks on the ruler will be placed. For a Horizontal ruler these can be above, below or cross. For a Vertical ruler these can be left, right or cross. The default placement for either is cross.
  major_tick_interval: The integer number of pixels between major ticks.
  major_tick_height: The integer 'height', or length, of each major tick
 
  major_label_low: The integer numeric value for the label at the first major tick. This feature will be changed to allow arbitrary labels in later releases.
  major_label_interval: The integer interval between consecutive major tick labels
 
  minor_tick_placement: The placement of minor ticks on the ruler (see above)
  minor_tick_interval: The integer pixel interval between minor ticks (see above)
  minor_tick_height: The height of minor ticks (see above)
  If you only want major tick then simply omit the minor_tick options
 
 
var tick_interval = 50;
var tick_height = 8; 

// Create a Horizontal ruler with no minor ticks
var ruler0 = new orthoRuler(panel, 50, 50, 'horizontal', 250,
                          { major_tick_placement: 'above',
                            major_tick_interval: tick_interval,
                            major_tick_height:   tick_height,
                            major_label_low: 0,
                            major_label_interval: 10
                          });

// Create a Vertical ruler with 5 minor intervals between each major tick
var ruler1 = new orthoRuler(panel, 50, 50, 'vertical', 250,
                          { major_tick_placement: 'left',
                            major_tick_interval:  tick_interval,
                            major_tick_height:    tick_height,
                            major_label_low: 0,
                            major_label_interval: 10,
                            minor_tick_placement: 'cross',
                            minor_tick_interval:  tick_interval/5,
                            minor_tick_height:    tick_height/2
                          });