3.7.5.31 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
layer.axis.refline#.TYPE Read/write
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).

layer.axis.refline#.VALUE Read/write
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.

layer.axis.refline#.LINESHOW Read/write
numeric

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

layer.axis.refline#.LINEAUTO Read/write
numeric

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

layer.axis.refline#.LINECOLOR Read/write
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);

layer.axis.refline#.LINESTYLE Read/write
numeric

Specify the line type for refline#.

layer.axis.refline#.LINETHICKNESS Read/write
numeric

Specify the line thickness in pts for refline#

layer.axis.refline#.FILLTONEXT Read/write
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

layer.axis.refline#.FILLCOLOR Read/write
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);.

layer.axis.refline#.FILLTRANS Read/write
numeric

Customize the fill color transparency in percentage.

layer.axis.refline#.labelshow Read/write
numeric

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

layer.axis.refline#.labelpos Read/write
numeric

Specify the label position: 0 = bottom, 1 = top, 4 = middle.

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.value$ = "Mean(plotdata(*, Y))"; //add a mean line at Y axis
layer.y.reflines.lineshow = 1;
layer.y.refline2.linecolor = color(blue);
layer.y.refline2.labelshow = 1;