# 3.7.5.32 Layer.Axis.Refline

The reference line object is a sub-object of the layer axis object. And axis is a sub-object of

layer object. You can use range notation to define a layer object:

range layerObject = [pageName]layerName!

And then access the axis object by:

layerObject.Axis.refline#.property

Where Axis is the axis specification: x is the bottom X axis, x2 is the top X axis, y is the left Y axis, y2 is the right Y axis, # refers to the index of the reference line.

Also refer to the object: layer.axis.reflines object

Required Version: Origin 2018 SR1

## Properties

Note: axis is a placeholder for x, y, x2, or y2.

Property Access Description
numeric

Specify to add the reference line at Axis Begin or Axis End: 1 = Axis Begin, 2 = Axis End.

Please note, this control is totally different from the Value Type drop-down list on the Reference Lines dialog which is used to specify the Value Type for the custom reference lines (excluding Axis Begin and Axis End).

numeric

Specify the position value or formula/function of refline#.

• Entering a value will add a vertical/horizontal straight line at the axis position.
• Entering a expression/function string will add a arbitrary straight line on current layer. See the second example below.

You can refer to the At Axis Value control in the Reference Lines dialog to learn the details of how to enter the value or string.

numeric

Whether to show refline#: 0 = hide, 1 = show.

numeric

Use auto format for refline# (follow the format of major grid lines). Set to 0 to disable auto formatting.

numeric

Specify the line color for refline#. The color function can be used, as in:

layer.x.refline1.LINECOLOR = color(blue); 

layer.x.refline2.LINECOLOR = color(240,208,0);

numeric

Specify the line type for refline#.

numeric

Specify the line thickness in pts for refline#

numeric

Specify the index number of reference line to which the area will be filled from the current refline#. Set to 0 to turn off fill pattern

numeric

Customize the fill color. The color function can be used, as in:

layer.x.refline1.FILLCOLOR = color(Origin);.

layer.x.refline2.LINECOLOR = color(255,0,128);.

numeric

Customize the fill color transparency in percentage.

numeric

Wheter to show label for refline#: 0 = do not show label, 1 = show label.

layer.axis.refline#.labeltext$Read/write string Specify the text to be shown as label for refline#. The default setting is <value as entered>, which means showing the position value as labeh. ## Example ### Example 1 The following scripts create a graph window, and then add two straight reference lines on X axis and customize reference lines. win -t p; //create a graph window layer.x.reflines.count = 2; layer.x.refline1.TYPE = 1; layer.x.refline2.value = 4; //add a reference line at x = 4 layer.x.reflines.lineshow = 1; layer.x.refline2.labelshow = 1; layer.x.refline2.FILLTONEXT=1; layer.x.refline1.FILLCOLOR=3; layer.x.refline1.FILLTRANS=50; ### Example 2 The script lines below create a graph window, and add two arbitrary straight reference lines, one with a LabTalk expression and another with a statistical function. //new a worksheet, fill the two column with row number. plotxy (1,2); //create a graph window with the data layer.y.reflines.count = 2; layer.y.refline1.value$ = "15-x"; //specify a expression to add a reference line Y=15-x
layer.y.refline2.labelshow = 1;