3.7.5.25 Layer

LabTalk Object Type:

Window


Note: A layer in Origin can be either a graph layer or a worksheet or matrixsheet (i.e. each worksheet/matrixsheet in a workbook/matrix is a layer). Most layer properties apply to a graph layer, but some apply to worksheets and matrix sheets. The wks object is the layer analogue for worksheets and matrixsheets.

The layer object controls the appearance of the specified (or active) layer. The layer object for a graph contains the axis sub-object. The axis object also contains sub-objects. You can either use the layer.property notation to access the active layer's properties, or use the range notation to define a layer range:

range layerObject = [winName]layerIndex!

For example:

// Use layer object to access active layer properties ...
layer.tickl = layer.tickl * 2; // Double the tick length
// or specify the layer (which need not be active) in the active graph ...
layer3.color = color(cyan); // Set layer3 background color to cyan
// or refer to layer in another window ...
// Set width of layer 2 in 'Graph2' to 50 (current units)
Graph2!layer2.width = 50; 
// Define two range variables ...
range layA = [Graph1]1!, layB = [Graph2]1!; 
layB.width = layA.width; // Make width of 'B' layer same as 'A'

Properties:

winName!layer#.property =

The winName! parameter is optional. If winName! is not specified, a layer in the active window is affected.

# is the layer number. If # is not specified, the active layer is used.

Property Applies Access Description
layer.3DCoor graphs Read/write,
numeric
Coordinate system: 1 = right-hand system, 0 = left-hand system.
layer.border graphs Read/write,
numeric
Layer border pattern: 0 = off, 1 = shadow, 2 = marble, 3 = white out, 4 = black out.
layer.bridgechart.enable

(2018 SR0)

graphs Read/write,
numeric
Enable Bridge Chart data plotting behavior. 0 = disable; 1 = enable.
layer.bridgechart.connectline

(2018 SR0)

graphs Read/write,
numeric
Show Connect Line between columns. 0 = disable; 1 = enable. Line can be customized using the draw command.
layer.bridgechart.connectbysubset

(2018 SR0)

graphs Read/write,
numeric
When connectline = 1, enable or disable Connect by Subset. 0 = disable; 1 = enable. When enabled, lines are drawn to connect subsets.
layer.bridgechart.subtotal$

(2018 SR0)

graphs Read/write,
numeric
Space-delimited set of data indices for totals/sub-totals (e.g. layer.bridgechart.subtotal$="1 3 5 7")
layer.bridgechart.cumulative

(2018 SR0)

graphs Read/write,
numeric
When enabled, only total/subtotal data points will be cumulatively stacked. 0 = disable; 1 = enable.
layer.camera.azimuth

(9.0 SR0)

3D OpenGL based graphs Read/Write,
numeric
Set the Azimuth of the 3D plot, refer to layer -cam command. Requires a window refresh when writing. ( e.g. doc -uw; )
layer.camera.inclination

(9.0 SR0)

3D OpenGL based graphs Read/Write,
numeric
Set the Inclination of the 3D plot. Requires a window refresh when writing.
layer.camera.roll

(9.0 SR0)

3D OpenGL based graphs Read/Write,
numeric
Set the Roll of the 3D plot. Requires a window refresh when writing.
layer.cindex

(8.5.1 SR0)

graphs,
worksheets,
matrices
Read only,
numeric
The zero-basic creation index of a layer for its own page. Note: The layer number can be gotten by the page.findLayer(cIndex) method with the specified creation index.
layer.color graphs Read/write,
numeric
Graph Layer color. Numbers from the color list, or transparent (0). The color() function can be used, as in: layer.color = color(blue);

Prior to 8.0, worksheet color referred to row/column header. It no longer applies.

layer.comments$

(9.0 SR0)

graphs,
worksheet,
matrices
Read/write,
string
Comments for a layer. Note: For a Worksheet, comments appear as a tooltip for the worksheet name and may be edited from a context menu. For a graph layer, the comments can only be accessed in LabTalk.
layer.commonrange

(2020b)

graphs Read/write,
string
Establish a common display range for all plots in the layer. 0=(default) no common display; 1 = common display range.
layer.coortype graphs,
worksheets
Read,
numeric
0=cartesian, 1=polar, 2=ternary, 3=smith chart, 16=3D
layer.displayname$

(9.1 SR0)

worksheets,
matrixsheets,
graphs
Read Only,
string
Returns the layer display name according to layer.namemode. Since graphs never show layer long names, this property can return a string which cannot be seen in the GUI.
layer.exchangexy graphs Read/write,
numeric
Only for Cartesian coordinates. Whether to flip XY axes; 1 = true, 0 = false.
layer.factor graphs Read/write,
numeric
Set scaling factor as on the Display tab of the layer's Plot Details dialog box. When layer.fixed is 0, layer.factor will update when user resizes the layer.
layer.fixed graphs Read/write,
numeric
Scale (Elements) With Layer Frame : 1 = unchecked, 0 = checked. See the Display tab of the layer's Plot Details dialog box.
layer.groupn.allCols graphs Read/write,
numeric
Plot all Y columns that are included in the plot group groupn, in the source worksheet. The group is comprised of a single X column, plus any and all Y columns to the right of that X column. This allows the user to add or remove columns of Y data in the source worksheet and have the graph update dynamically: 1 = update graph dynamically, 0 = do not update.
//auto update plots in group1 when add/remove datasets in source sheet
layer.group1.allCols=1
layer.height graphs Read/write,
numeric
Height of the layer frame, measured in units specified by layer.unit.
layer.include.group graphs,
worksheets
Read/write,
numeric
Used when the layer.include() method is operating on a vector. 1 = group and 0 = ungroup.
layer.HideOthers

(2020)

graphs Read/write,
numeric
Show the active layer only, hide other layers: 1 = Hide other layers and 0 = Show all layers
layer.include.useAll graphs,
worksheets
Read/write,
numeric
Used when adding datasets with the layer.include() method in a box chart. 1 = disregard column designations, 0 = use column designations.
layer.is3D graphs Read only,
numeric
Returns 1 if the layer is from a 3D plot type (3D charts, 3D surfaces, and 3D wire frames). Otherwise, returns 0.
layer.is3DGL graphs Read only,
numeric
Returns 1 if current 3D plot is based on 3D OpenGL. Otherwise, returns 0 for GDI based graph supported in version earlier than Origin 9.0.
layer.isisometric

(2015 SR0)

graphs Read/write,
numeric
Link Axis Length to Scale with X:Y Ratio (isometric) for 2D graphs: 1 = Link axis length to scale, 0 = Do not link axis length to scale. See the Size tab of the layer's Plot Details dialog box.
layer.left graphs Read/write, numeric Distance from the frame to the left edge of the page. Measured in units specified by layer.unit.
layer.link graphs Read/Write,
numeric
Linked To layer number, 0 if no link.
layer.light graphs Read/Write,
numeric
The following properties exist to control lighting in 3D openGL plots:
Property Description
.mode Lighting Mode: 0 = None, 1 = Directional.
.direction.h Direction, Horizontal: the direction of light source in the horizontal plane 0 to 359.
.direction.v Direction, Vertical: the direction for light source in the vertical plane: -90 to 90.
.direction.dynamic Dynamic Light Source: 0 = enable, 1 = disable.
.ambient Light Color, Ambient: color is a number from the LabTalk List of Colors.
Alternately, use the LT color() function to specify a color.
.diffuse Light Color, Diffuse: color is a number from the LabTalk List of Colors.
Alternately, use the LT color() function to specify a color.
.specular Light Color, Specular: color is a number from the LabTalk List of Colors.
Alternately, use the LT color() function to specify a color.
.ka Ambient Intensity: not used.
.kd Diffuse Intensity: value from 0 to 100.
.ks Specular Intensity: value from 0 to 100.
.shininess Shininess: value from 0 to 100.

Note that user-interface controls for these settings are found in two places:

layer.longname$

(9.1 SR0)

worksheets,
matrixsheets,
graphs
Read/Write,
string

Long Name for a layer. Beginning with Origin 2020b, worksheet/matrixsheet "Long Name" becomes "Label". longname can hold up to 518 characters. In versions prior to Origin 2020, display of Long Name on the sheet tab was controlled by layer.namemode. However, beginning with Origin 2020, layer.namemode will only apply when system variable @SSL = 0.

Graph layers have no option to show Long Name although the property can be read and written.

layer.matmaxptsenabled

(8.1 SR2)

graphs Read/Write,
numeric
Enable/Disable speed mode for graphs from matrix.

See also:
layer.matmaxrows
layer.matmaxcols

layer.matmaxcols

(8.1 SR2)

graphs Read/Write,
numeric
Maximum columns to show when speed mode is on. This value should greater than or equal to 2.

See also:
layer.matmaxptsenabled

layer.matmaxrows

(8.1 SR2)

graphs Read/Write,
numeric
Maximum rows to show when speed mode is on. This value should greater than or equal to 2.

See also:
layer.matmaxptsenabled

layer.maxpts graphs Read/write,
numeric
Speed mode for worksheet data plots. Maximum number of data points to display for each column based data plot, for screen display only. Printing and export will not use speed mode (unless requested). To turn off speed mode for worksheet data plots, set this to 0.
layer.name$ graphs,
worksheets,
matrixsheets
Read/write,
string
The Short Name of the active layer. Beginning with Origin 2020b, worksheet/matrixsheet "Short Name" becomes "Name". Prior to Origin 2020, you used layer.namemode to control whether to show Short Name or Long Name on the sheet tab. Since Origin 2020, tab name display is controlled by system variable @SSL.
layer.namemode

(9.1 SR0)

worksheets,
matrixsheets
Read/write,
numeric
Determines how sheet name should display. 0 = Show Long Name if available, 1 = Short Name(default), 2 = Long Name. Note that with Origin 2020, this property became obsolete, having been replaced by system variable @SSL.
layer.plot graphs Read/write,
numeric
Active data plot number in the layer.
layer.plot.label.color graphs Read/write,
numeric
Active data plot label color.
layer.plot.label.color=2 // LabTalk list of colors (1=black, 2=red, 3=green, etc.)
layer.plot.label.color=color(#FF0000); // use color function with HTML, RGB values
layer.plot.label.form$ graphs Read/write,
string
Active data plot label form. Set Label Form to Custom and specify Format String
layer.plot.label.form$=%(?,@LL); // label using column Long Name
layer.plot.label.fsize graphs Read/write,
numeric
Active data plot label font size, in points.
layer.plot.label.spec$ graphs Read/write,
string
  • Enable show data labels only at points specified:
layer.plot.label.spec$="end"; // enables display of label at last data point
layer.plot.label.spec$="1 10 20 30"; // enables display of labels at point indices 1, 10, 20, 30.

If labels are not enabled, enable labels.

  • To turn off the Show at Specified Points Only box (Plot Details Label tab), use
layer.plot.label.spec$=""; // clear "Show at Specified..." check box
  • To disable label display altogether, use set -q
set %C -q 0; // turn off labels for active plot
layer.plotn.subgroupsize

(9.1 SR0)

graphs with grouped data plots Read/write,
numeric
Set the size of subgroup. n should be the plot index of the first data plot in a group.
layer.plotn.subgrouplabelrow

(2016 SR0)

graphs with grouped data plots Read/write,
numeric
Set the column label row for subgrouping. n should be the plot index of the first data plot in a group. 1 = Long Name, 2 = Units, 3 = Comments, 4 = Sampling Interval, etc. Note that when this option is enabled, it will override layer.plotn.subgroupsize.
layer.plotn.usepropssubgroup

(2016 SR0)

graphs with grouped data plots Read/write,
numeric
Specify whether to use the increment list repeatedly in each subgroup or between subgroups. 0 = do not use increment, 1 = use increment list repeatedly within each subgroup, 2 = use increment list repeatedly between subgroups. n should be the plot index of the first data plot in a group.
layer.ResizeParent

(9.1 SR0)

graphs Read/write,
numeric
Specify whether the parent layer will follow the moving/resizing of current linked child layer. 0 = not follow, and 1 = follow.
layer.s

(2020)

graphs Read/write,
numeric
Edit the property of the selected axis in the layer. For example, you can use the following scripts to rescale bottom X axis range if it has been selected.
layer.S.From = 5;
layer.S.To = 10;
layer.show

(8.6 SR0)

graphs,
worksheets,
matrices
Read/write,
numeric
Show or hide the layer: 1 = show, 0 = hide.
layer.showData graphs Read/write,
numeric
Display of data plots: 1 = show, 0 = hide.
layer.showLabel graphs,
worksheets
Read/write,
numeric
Display of text and graphic objects: 1 = show, 0 = hide. Unlike objects hidden with the Visible check box in the Label Control dialog box, all labels remain selectable.
layer.showx
layer.showy
graphs Read/write,
numeric
Display of X or Y axis: 1 = show, 0 = hide.
layer.tickL graphs Read/write, numeric Tick length in units of 0.1 pt. When you set this property, it sets the tick length for all the ticks in the layer. When you read this property, it returns the tick length for the first displayed X axis in the layer.
layer.tickW graphs Read/write,
numeric
Tick thickness. See layer.tickL for read and set conventions.
layer.top graphs Read/write,
numeric
Distance from the frame to the top edge of the page. Measured in units specified by layer.unit.
layer.unit graphs Read/write,
numeric
Layer frame measurement units: 1 = % page, 2 = inches, 3 = cm, 4 = mm, 5 = pixel, 6 = points, and 7 = % of linked layer.
layer.width graphs Read/write,
numeric
Width of the layer frame, measured in units specified by layer.unit.

Methods:

Method Description
layer.include(Dataset [,PlotType]) Dataset is the name of the dataset to be added to the active graph layer. PlotType (optional) is the Plot Type ID for the desired graph.
layer.plot.copy() Copy the active plot or active plot group, to the Clipboard.