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
 Script to change graph references
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

LC_

42 Posts

Posted - 05/24/2011 :  04:28:49 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): 8.5.0 SR1
Operating System: Win 7

Hi

Assume I have several similarly formatted workbooks with same column structures. I have a (usually complex line+symbol graphs) graph for which I would like to be plotted for other workbooks as well. As I couldn't find a simple way of duplicating the plot structure across different workbooks in a similar fashion of Analysis Templates (is there any way of doing it?) I'm inclined to doing it via script.

So the idea was to write a script that duplicates a graph, and swaps the workbook reference for every plot in the graph. I didn't find a command for doing changing the plot reference in the command list, and if I tried to loop trough the graphs re-plotting every line the formatting would probably be lost, differently from what would happen if you replaced manually each plot using Plot Setup.

Some directions are much appreciated.

Sam Fang

293 Posts

Posted - 05/26/2011 :  02:28:27 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Origin's theme can apply a graph's format on other graphs.

If you want to use Labtalk script, you can save your graph as a template. Then use script to plot data in other workbooks using the template. Labtalk also provides command to add a plot into an existing layer. See the page for details.
http://wiki.originlab.com/~originla/ltwiki/index.php?title=Script:Creating_Graphs

We already have reported a JIRA ORG-8 about your suggestion to change data for a plot. It may be available in the future.

Thanks.

Sam
OriginLab Technical Services
Go to Top of Page

Penn

China
644 Posts

Posted - 05/26/2011 :  02:29:28 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

First of all, you can save the first graph you make as a template (you can do it by menu File: Save Template As when the graph is active). And then use the document command to loop over all the workbooks in the project for creating graphs.

In each loop cycle, firstly, use the win command to open the saved template, and then the plotxy X-Function can be used to add plots to the template. Because I don't know what is your data and how your graph looks like, here I just show a simple example on how to use the commands mentioned above.

// execute the script for all workbook in the project
document -e W
{
	range rx = [%H]1!1;  // x column
	range ry = [%H]1!2:5;  // multiple y columns
	win -t p myTem.otp;  // open the template, named myTem.otp
	plotxy iy:=(rx, ry) plot:=202 ogl:=1;  // plot line+symbol to layer 1	
}


Penn
Go to Top of Page

LC_

42 Posts

Posted - 05/26/2011 :  03:13:35 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks guys. I will try it next week and let you know!
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