2.5.35 legendupdate


Menu Information

Graph: Update Legend

Brief Information

Update or reconstruct graph legend

Command Line Usage

1. legendupdate dest:=layer update:=reconstruct legend:=combine order:=ascend mode:=lu;


X-Function Execution Options

Please refer to the page for additional option switches when accessing the x-function from script

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
Update Scope dest

Input

int

0
Specifies where to apply the legend updates.

Option list:

  • page:Whole Page
    Update the legends on the whole active page.
  • layer:Active Layer
    Update the legends on the active layer.
  • spepage:Specific Page
    This is not visible in the dialog box. When this is selected, only the legends on the graph page specified by the page variable will be updated.
  • spelayer:Specific layer
    This is not visible in the dialog box. When this is selected, only the legends on the graph layer specified by the layer variable will be updated.
Update Mode update

Input

int

1
Specifies whether to reconstruct or update the legend.

Option list:

  • reconstruct:Reconstruct
    Reconstruct the legend(s) according to the Auto Legend Translation Mode and Order variables.
    Note: It will restore the legend(s) format to the default setting.
  • update:Update
    Update the information of existing legend(s) by the specified variable .
    Note: It will not change the format and structure of the existing legend(s).
Legend legend

Input

int

0
This is only available when reconstruct is selected for the update variable. Use this variable to specify the type of legend you want to reconstruct.

Option list:

  • separate:Legend for each Graph
    Construct a separate legend for each layer.
  • combine:One Legend for Whole Page
    Construct a legend for all layers in the graph.
Order order

Input

int

1
This is only available when reconstruct is selected for the update variable. When a legend is reconstructed, information must be read from the graph layers. This variable controls the order to read the layers.

Option list:

  • descend:Descending
    Read information from the layers according to their indices in descending order.
  • ascend:Ascending
    Read information from the layers according to their indices in ascending order.
Plot Order within Layer porder

Input

int

1
This is only available when reconstruct is selected for the update and combine is selected for the legend variable. This variable controls the plot order to read within a layer.

Option list:

  • descend:Descending
    Read plot information within a layer according to their indices in descending order.
  • ascend:Ascending
    Read plot information within a layers according to their indices in ascending order.
Auto Legend Translation Mode mode

Input

int

0
LabTalk variable notations ("%(1)", "%(2)", etc.) is used to create legends. Origin automatically "translate" the notations into information when constructing a legend. This variable specifies the information that will be used to translate the notations.

Option list:

  • comment:@LM:Use Comment (1st line)
    The first line in the Comments row of the source data. Otherwise use the column Long Name. If neither Comments nor Long Name contains contents, use the Short Name of the corresponding column.
  • dr:@R:Data Range
    The data range of the plot.
  • lu:@U:Long Name & Units
    The Long Names and Units of the source data. If Long Name contains no content, the column Short Name will be used instead
  • udpara:@LD:User Parameter 1
    The first User Parameter row of the source data.
  • lname:@LA:Long Name
    The Long Name of the source data.
  • sname:@LS:Short Name
    The Short Name of the source data.
  • lpara:@LP:Parameter 1
    The first system Parameter of the source data.
  • custom:Custom
    The information specified by the custom variable.
Legend Custom Format(@D,@LU etc) custom

Input

string

This is available only when custom is selected for the mode variable. You can add any literal before, after and in between the legend notations. Notations entered here will be used to translate.
Additional Format (for @L, @V etc.) addon

Input

string

This is available only when custom is selected for mode and @L, @V or @WT is selected for custom variable. Specify nth row and/or mth column to complete notation of worksheet cell access. Refer to Notations for details.
GraphPage page

Input

GraphPage

<optional>
This is only available when dest variable is set to spepage. Use it to specify a graph page. Then the legend(s) on the graph page will be updated.
GraphLayer layer

Input

GraphLayer

<optional>
This is only available when dest variable is set to spelayer. Use it to specify a graph layer. Then the legend on the graph layer will be updated.
Show Legend for Visible Plots Only hide

Input

int

1
Specify whether to show the hidden plot in legend
Hide Legend for Fitted Curves fit

Input

int

0
Specify whether to hide the fitted curve(s) in legend or not
Indicate Active Dataset indicate

Input

int

1
Specify whether to indicate the active dataset in the legend.

Description

This X-function can be used to update or reconstruct legends on graphs or layers. It is accessible from menu with a graphical dialog. You can refer to this online help for the controls in graphical dialog.

Examples

This example shows how to update graph legends. The sample data can be imported from <exe_path>\Samples\Signal Processing\Signal with Shot Noise.dat.

// Get sample data
fn$ = system.path.program$ + "Samples\Signal Processing\Signal with Shot Noise.dat";
newbook;
impASC fn$;

// Plot a line graph, 
//the default legend uses both worksheet long name and unit as legend.
plotxy col(2) plot:=0;

// Update legend;
legendupdate mode:=lu;