The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Legend Update Dialog Formatting Hints Script
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cdrozdowski111

USA
247 Posts

Posted - 08/08/2013 :  06:32:29 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I'm offering the LT code below as a method of providing helpful legend formatting token hints for the Legend Update dialog. It's not sophisticated but does the job. The tokens are based on Origin9.0.0 SR2 so if you have an earlier version, you might need to modify them.

You can put the script in a menu item or toolbar button with this code:

run.section(myscriptfilename.ogs, mylegendupdate);

Here's the script:

// Labtalk wrapper for legendupdate X-Function. Displays formatting tokens in the classic script window
[mylegendupdate]

// Clear script window (optional- may comment out)
type -o new;

// Type tokens to classic script window
type -a "Legend Formatting Tokens";
type -a "========================";
type -a "@C => Column short name.";
type -a "@D => Dataset name.";
type -a "@LA => Long Name, if available, else Short Name.";
type -a "@LC => Comment.";
type -a "@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.";
type -a "@LG => Long Name, if available, else Short Name and Units.";
type -a "@LH => Header (entire header) (NOT CURRENTLY IMPLEMENTED!).";
type -a "@LL => Long Name.";
type -a "@LM => Comments (first line), if present, or Long Name, if present, else Short Name.";
type -a "@LN => Equivalent to @LM + @LU.";
type -a "@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.";
type -a "@LQ<n> => The legend will show the User Parameter + [@LU].";
type -a "@LS => Short Name.";
type -a "@LU => Units, not including Long Name, and without brackets [] or parentheses( ).";
type -a "@R => Full range string.";
type -a "@U => Equivalent to @LG (previous notation).";
type -a "@W => Book Short Name.";
type -a "@WL => Book Long Name.";
type -a "@WS => Sheet name.";

// Clear selections on page
page -s;

// Active first layer
page.active = 1;

int isCancel;

// Open legendupdate X-Function dialog with isCancel switch
legendupdate -dc isCancel;

// Optional legend positioning code (example below)
/*
if (isCancel == 0)
{
	legend.x = layer.x.to - (legend.dx/2);
	legend.y = layer.y.to - (legend.dy/2);
}
*/

// Clear script window (optional- may comment out)
type -o new;

// Hide script window
type -h;

return (isCancel == 0);
// End section

greg

USA
1378 Posts

Posted - 08/26/2013 :  10:22:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
We are implementing a list like this in 9.1. When you select Custom for "Auto Legend Translation Mode" there will be a flyout button which gives you a similar list and each selection will add to the Legend substitution string.
Much better than those cryptic @strings. Thanks for the suggestion.
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000