LabTalk:Text Label Options

From LabTalk Wiki

Jump to: navigation, search

Labtalk supports applying existing page and dataset information to your text labels, using syntax such as:

objectName.text$ = %([workbookName]worksheetName!columnName,@option, variableName)

in which variable options are liested in Substitution Notation

or using

objectName.text$ = %(nColType, @option)

or, in an X-Function, use an option such as:

legendupdate mode:=custom custom:=@option

The @ text-label options can be applied to any text label on a graph, such as a graph legend, as in:

legend.text$ = %(2Y, @LC);

which tells Origin: for the 2nd dataplot in the current layer, use the comment field (of the Y column plotted) as the legend entry.

Besides legend other text object names on a graph include yl (left-side y-axis), xb (bottom x-axis), so that

yl.text$ = %(?Y,@WL);   // Make the workbook long name = Y-label text  
xb.text$ = %(1X,@LU);   // Make the units of the X dataset the X-label

The %(?Y) is a special syntax that allows the text label to default to a pre-specified data plot index (which can be set in Plot Details: Legends/Titles: Data Plot Index for Auto Axis Titles), instead of an index (1, 2, ... n) that you supply.

Every text label on a graph has a text object name. To get that name, select the text label by clicking on it with your mouse, right click, and select Programming Control .... The Object Name field contains the name, whose text$ attribute can be changed as above.

To use the X-Function method:

legendupdate mode:=custom custom:=@R;

which tells Origin: for all legend entries, report the location (in Origin Range Notation) of the data being plotted.

The table below presents the available options, using syntax mentioned above:

Option Return Value
@C Column short name.
@D Dataset name.
@LA Long Name, if available, else Short Name
@LC Comment
@LD<n> User Parameter. @LD is the same as @LD1, but in order to use @LD2, you will need at least two user defined parameters.
@LG Long Name, if available, else Short Name and Units
@LH Header (entire header) (NOT CURRENTLY IMPLEMENTED!)
@LL Long Name
@LM Comments (first line), if present, or Long Name, if present, else Short Name.
@LN Equivalent to @LM + @LU
@LP<n> Parameter; @LP is the same as @LP1. In order to use @LP2, @LP3, you will need those Parameter rows shown in the worksheet.
@LQ<n> The legend will show the User Parameter + [@LU]
@LS Short Name
@LU Units, not including Long Name, and without brackets [] or parentheses( )
@R Full range string.
@U Equivalent to @LG (previous notation)
@W Book Short Name
@WL Book Long Name
@WC Book Comments
@WS Sheet name
@WM Sheet Comments

Note that when showing units on the legend, the English and Japanese versions use parentheses ( ) while the German version uses square-brackets [ ] surrounding units.

Personal tools