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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Saving plotting scripts into Graph Template

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
Atedge Posted - 05/06/2021 : 11:45:52 AM
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 2021b (64-bit) 9.8.5.201
Operating System: Windows 10 20H2 (19042.928)
I've tried the new feature of OriginPro 2021b: Support saving plotting scripts into Graph Template, though there 're not much document to introduce it in detail, like https://www.originlab.com/doc/Origin-Help/Graph-Template-Elements#Additional_Scripts_Saved_with_Template , https://d2mvzyuse3lwjc.cloudfront.net/releasenotes/detail.aspx?id=2021b3ORG-22820 .
With this new feature, I can take data from other worksheets as the "axis.from" and "axis.to" of graph plotted by a template. A demo code like:
range klwks = [Book9]Sheet1!,klcol = %(klwks)col(a),kccol = %(klwks)col(b),gr1 = !;
int klnr = klwks.maxRows;
gr1.x.from = kccol[1];
gr1.x.to = kccol[$(klnr)];


And as https://www.originlab.com/doc/Origin-Help/Graph-Template-Elements#Additional_Scripts_Saved_with_Template say, I should do like
page.info.system.plotting.LTAfter$="<the demo code above>"
.

But it didn't work. And the result of "page.info.=;" shows:
page.info.=
<SYSTEM>
[PLOTTING]
MODIFIERMATCHTYPE = 0
PRESETLN$ = "test-demo"
PRESETSN$ = "<auto>"
MODIFIERUDPNAME$ = ""
CLONEMATCH = 3
TEMPLATE$ = "test-demo"
LT$ = ""
LTAFTER$ = "range klwks = [Book9]Sheet1!,klcol = % (klwks)col(a),kccol = % (klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[0];"
[PAGE]
[DISPLAY]
NUMERICSEPARATORS = -1
[LEGEND]
CUSTOMFORMAT$ = "@LL"

SO I have some quetion about "Saving plotting scripts into Graph Template":
1) Can "LTAFTER$" handle %() and $() notations and string reqister properly? I've tried had string register in it, and it will resolve it right after you enter the command, other than running time. How to get these resovled correctly when plotting?
2) Can I use system and user defined variables inside the "LTAFTER$"?
3) Is there special limit of the syntax to take care inside the quotes of "LTAFTER$"?
4) Is there a limitation of the length of the script inside the quotes of "LTAFTER$"?
10   L A T E S T    R E P L I E S    (Newest First)
YimingChen Posted - 05/11/2021 : 4:25:50 PM
Yes, I can reproduce the issue. I have reported it (ORG-22820).

James
Atedge Posted - 05/11/2021 : 03:05:27 AM
I checked it again, and probably found where the problem lied: the script saved with graph behaves differently between a normal template and a cloneable template.The script within a normal graph template works well, but within a cloneale one it takes no effects. I attached my test project file here for anyone to reproduce this problem. Is this a bug?
https://my.originlab.com/ftp/forum_and_kbase/Images/DemoTest.zip
YimingChen Posted - 05/10/2021 : 10:04:57 AM
Can you double check? It works for me. I followed the steps below:

1. New a project, fill col(A) and col(B) with row index. Make a scatter plot.
2. Run the script
page.info.system.plotting.LTAfter$="range klwks = [Book1]Sheet1!,klcol = %%(klwks)col(a),kccol = %%(klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[$"+"(klnr)];";


3. Save template and create a plot with the template. Should see the x axis has the scale range 1~32.

James
Atedge Posted - 05/08/2021 : 01:31:35 AM
I tried your new syntax, and the content of LTAFTER$ in the page.info seems to be normal now, but actually nothing happened after the script runed, neither when reploted using the template with the script had saved in the page.info.system.plotting.LT$ or page.info.system.plotting.LTAfter$.
Here is the page.info after using the new syntax:
page.info.=
<TREE>
Binary data (167 bytes)
<SYSTEM>
[PLOTTING]
MODIFIERMATCHTYPE = 0
PRESETLN$ = "<auto>"
PRESETSN$ = "<auto>"
MODIFIERUDPNAME$ = ""
TEMPLATE$ = "TestDemo-SCATTER"
CLONEMATCH = 3
LT$ = "range klwks = [Book1]Sheet1!,klcol = %(klwks)col(a),kccol = %(klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[$(klnr)];"
YimingChen Posted - 05/07/2021 : 2:57:18 PM
OK. Here is what happened. Because when you run the script:

page.info.system.plotting.LTAfter$="range klwks = [Book1]Sheet1!,klcol = %(klwks)col(a),kccol = %(klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[$(klnr)];"


range klwks is not defined, so the substitution %(klwks) doesn't resolve to anything. So we want the substitution to happen when the graph is created from the template. So a workaround is use the script below instead
page.info.system.plotting.LTAfter$="range klwks = [Book1]Sheet1!,klcol = %%(klwks)col(a),kccol = %%(klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[$"+"(klnr)];";


See if that works. Thank you.

James
Atedge Posted - 05/07/2021 : 01:23:42 AM
What's the version of your OriginPro? I can't reproduce it by your steps. And "page.info.=" shows
page.info.=
<TREE>
Binary data (167 bytes)
<SYSTEM>
[PLOTTING]
MODIFIERMATCHTYPE = 0
PRESETLN$ = "<auto>"
PRESETSN$ = "<auto>"
MODIFIERUDPNAME$ = ""
TEMPLATE$ = "TestDemo-SCATTER"
LTAFTER$ = "range klwks = [Book1]Sheet1!,klcol = % (klwks)col(a),kccol = % (klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[--];"
CLONEMATCH = 3

I noticed that although I inputed "%(klwks)",it was resolved as "% (klwks)",a <space> between % and (. And "kccol[$(klnr)]" was resolved as "kccol[--]". My Origin version is OriginPro 2021b (64-bit) 9.8.5.201 (Learning Edition).I wonder if the behavior varies between different vesions of OriginPro.

quote:
Originally posted by YimingChen

<TREE>
Binary data (167 bytes)
<SYSTEM>
[PLOTTING]
MODIFIERMATCHTYPE = 0
PRESETLN$ = "<auto>"
PRESETSN$ = "<auto>"
MODIFIERUDPNAME$ = ""
LTAFTER$ = "range klwks = [Book1]Sheet1!,klcol = [Book1]Sheet1!col(a),kccol = [Book1]Sheet1!col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[32];"

quote:
Originally posted by Atedge

What's the result of the command
page.info.=;
? "gr1.x.to = kccol[0];" at the end of LTAfter$ rather than "gr1.x.to = kccol[$(klnr)];" ?
quote:
Originally posted by YimingChen

It worked for me, the steps are:
1. New a project, fill col(A) and col(B) with row index. Make a scatter plot.
2. Run the script
page.info.system.plotting.LTAfter$="range klwks = [Book1]Sheet1!,klcol = %(klwks)col(a),kccol = %(klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[$(klnr)];"

3. Save template and create a plot with the template. Should see the x axis has the scale range 1~32.

James





YimingChen Posted - 05/06/2021 : 2:51:17 PM
<TREE>
Binary data (167 bytes)
<SYSTEM>
[PLOTTING]
MODIFIERMATCHTYPE = 0
PRESETLN$ = "<auto>"
PRESETSN$ = "<auto>"
MODIFIERUDPNAME$ = ""
LTAFTER$ = "range klwks = [Book1]Sheet1!,klcol = [Book1]Sheet1!col(a),kccol = [Book1]Sheet1!col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[32];"

quote:
Originally posted by Atedge

What's the result of the command
page.info.=;
? "gr1.x.to = kccol[0];" at the end of LTAfter$ rather than "gr1.x.to = kccol[$(klnr)];" ?
quote:
Originally posted by YimingChen

It worked for me, the steps are:
1. New a project, fill col(A) and col(B) with row index. Make a scatter plot.
2. Run the script
page.info.system.plotting.LTAfter$="range klwks = [Book1]Sheet1!,klcol = %(klwks)col(a),kccol = %(klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[$(klnr)];"

3. Save template and create a plot with the template. Should see the x axis has the scale range 1~32.

James



Atedge Posted - 05/06/2021 : 2:46:21 PM
What's the result of the command
page.info.=;
? "gr1.x.to = kccol[0];" at the end of LTAfter$ rather than "gr1.x.to = kccol[$(klnr)];" ?
quote:
Originally posted by YimingChen

It worked for me, the steps are:
1. New a project, fill col(A) and col(B) with row index. Make a scatter plot.
2. Run the script
page.info.system.plotting.LTAfter$="range klwks = [Book1]Sheet1!,klcol = %(klwks)col(a),kccol = %(klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[$(klnr)];"

3. Save template and create a plot with the template. Should see the x axis has the scale range 1~32.

James

YimingChen Posted - 05/06/2021 : 2:01:13 PM
It worked for me, the steps are:
1. New a project, fill col(A) and col(B) with row index. Make a scatter plot.
2. Run the script
page.info.system.plotting.LTAfter$="range klwks = [Book1]Sheet1!,klcol = %(klwks)col(a),kccol = %(klwks)col(b),gr1 = !;int klnr = klwks.maxRows;gr1.x.from = kccol[1];gr1.x.to = kccol[$(klnr)];"

3. Save template and create a plot with the template. Should see the x axis has the scale range 1~32.

James
Atedge Posted - 05/06/2021 : 11:53:20 AM
5) Could a GUI dialog for the scripts saved with the template be available in the future release? Just like "Import Wizard, The Advanced Options Page" https://www.originlab.com/doc/Origin-Help/ImpWiz-AdvanOptPage


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000