Layer

LabTalk Object Type:

Window


Note: A layer in Origin can be either a graph layer or a worksheet or matrix sheet (i.e. each worksheet/matrix sheet 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 matrix sheets.

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[n].property =

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

n is the layer number. If n 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.bounds.height N/A N/A Not currently implemented.
layer.bounds.left N/A N/A Not currently implemented.
layer.bounds.top N/A N/A Not currently implemented.
layer.bounds.width N/A N/A Not currently implemented.
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.coortype graphs,
worksheets
Read,
numeric
0=cartesian, 1=polar, 2=ternary, 3=smith chart, 16=3D
layer.disp graphs Read/write,
numeric
Display column or bar graphs with zero values: 0 = do not show zero-valued columns or bars as a line, 1 = show zero-valued columns or bars as a line.
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.
layer.group1.allCols=1 // dynamically update plots in group1 when datasets are added or removed in source sheet
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.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 (isometric) for 2D graphs: 1 = Link axis length to scale, 0 = Do not link axis length to scale. See the Size/Speed tab of the layer's properties 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. Worksheet/matrix sheet long names could show if layer.namemode is not set to Short Name(the default). Graph layers have no option to show Long Name although the property can be read and written. longname can hold up to 518 characters.
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. Worksheets and matrix sheets names could be shown if layer.namemode is set to Short Name. Graph layer short names can be modified/viewed in the left panel of Plot Details dialog.
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
layer.period N/A N/A This property is no longer in use.
layer.plot graphs Read/write,
numeric
Active data plot number in the layer.
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 subgroup, 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.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 .1 of a point. 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 numeric value for the desired gr