# 3.7.5.26 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
numeric
Coordinate system: 1 = right-hand system, 0 = left-hand system.
layer.bixy$(2022) graphs Read/write, string Apply layer XY coordinates to the image inserted into graph layer as background for project created in Origin 2021b and previous. • layer.bixy$="update"; to update the coordinates of background image with unit to that of graph layer.
• layer.bixy$=; to return the image coordinates 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)

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, worksheets, matrices Read/write, numeric For graph, it's layer's background color; and for worksheet/matrix it's tab 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
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)

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
numeric
0=cartesian, 1=polar, 2=ternary, 3=smith chart, 16=3D
layer.displayname$(9.1 SR0) worksheets, matrixsheets, graphs Read Only, string It is obsolete for workbook since Origin 2020b. Use layer.name$ instead.
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.
numeric
Only for Cartesian coordinates. Whether to flip XY axes; 1 = true, 0 = false.
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.
numeric
Scale (Elements) With Layer Frame : 1 = unchecked, 0 = checked. See the Display tab of the layer's Plot Details dialog box.
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
numeric
Height of the layer frame, measured in units specified by layer.unit.
layer.include.group graphs,
worksheets
numeric
Used when the layer.include() method is operating on a vector. 1 = group and 0 = ungroup.
layer.HideOthers

(2020)

numeric
Show the active layer only, hide other layers: 1 = Hide other layers and 0 = Show all layers
layer.include.useAll graphs,
worksheets
numeric
Used when adding datasets with the layer.include() method in a box chart. 1 = disregard column designations, 0 = use column designations.
layer.info graphs,
worksheets,
matrixsheets
tree
Layer storage object. Typically contains metadata associated with imported file. To access the data of User Tree, please use layer.info.tree.
tree tr = layer.info.tree$; //get tr.=; layer.info.tree$ = tr$; //set 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
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)

numeric
Enable/Disable speed mode for graphs from matrix.

layer.matmaxrows
layer.matmaxcols

layer.matmaxcols

(8.1 SR2)

numeric
Maximum columns to show when speed mode is on. This value should greater than or equal to 2.

layer.matmaxptsenabled

layer.matmaxrows

(8.1 SR2)

numeric
Maximum rows to show when speed mode is on. This value should greater than or equal to 2.

layer.matmaxptsenabled

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
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
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.
numeric
Active data plot number in the layer.
layer.ResizeParent

(9.1 SR0)

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)

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
numeric
Show or hide the layer: 1 = show, 0 = hide.
numeric
Display of data plots: 1 = show, 0 = hide.
layer.showLabel graphs,
worksheets
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.
numeric
Internal angle between X and Y axes. Need to run layer -PGM 1 to enable axis skew first.
numeric
Positive values rotate X axis in counter-clockwise direction. Need to run layer -PGM 1 to enable axis skew first.
layer.showx
layer.showy
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.
numeric
Tick thickness. See layer.tickL for read and set conventions.
numeric
Distance from the frame to the top edge of the page. Measured in units specified by layer.unit.
numeric
Specify how to decide the table edge for the axis table row when you have set Major Tick Type as By Custom Positions with a column; or when using some date-time Formats with axis (tick) tables.

When layer.tpx=1, use the center of custom ticks as table edge.
When layer.tpx=0, use the custom tick position as table edge. By default, layer.tpx=0.

numeric
Layer frame measurement units: 1 = % page, 2 = inches, 3 = cm, 4 = mm, 5 = pixel, 6 = points, and 7 = % of linked layer.
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.
layer.ROI(append,type,width,optn)

(2022)

• append determines whether to add or remove ROI. Option list:
 0 Clean existed ROI(s) on the layer and add a new ROI. Delete all ROI(s) in the layer. Append a new ROI to the layer.
• type determines the shape of ROI box. Option list:
 0 Rectangle ROI Horizontal span across layer Vertical span across layer
• width specifies the width of ROI box. defaul "0" means ignoring the width.
• optn determines the ROI is resizable or not: 1 = disable resizing, 0 = enable resizing

For example,

layer.ROI(); //add a ROI of default settings in the middle of the layer
layer.ROI(-1); //delete all ROIs in the layer

//append a span-layer vertical ROI with 3 pixel in width and disable resizing
layer.ROI(1,2,3,1);
layer.setstr(name,text)

(2022)

If import multiple image files into one image window, use layer.setstr and layer.getstr to set and get specified layer name. Use layer.setstr to set name of name layer frame as text.
layer.getstr(name,StringReg)

(2022)

If import multiple image files into one image window, use layer.setstr and layer.getstr to set and get specified layer name. Use layer.getstr to get name of name layer frame and save it to a% String Register.

For example,

//save name of layer ''myocyte1'' to %A
layer.getstr(myocyte1,A);