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
 Add dataset to graph by 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

szailer

USA
10 Posts

Posted - 09/16/2009 :  11:59:24 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.0
Operating System: XP

I'd like to add different datasets from different worksheets to an existing graph by a script so I do not have to search the datasets in the 'layer contents'.

So I'd like to do something like this:
add to layer1 book1_c100
add to layer1 book2_c100
add to layer1 book3_c100

My data to be plotted is always in the same column so it would speed up my work.

Thanks

easwar

USA
1964 Posts

Posted - 09/16/2009 :  5:10:10 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can use code such as below. you may need to apply the free SR6 patch (or patch up to SR6) depending on what your SR is right now...for the code to work.

Easwar
OriginLab


// Point to the graph layer, assuming here it already exists
range rGly = [Graph1]1!;
// Loop over all sheets in all books
doc -e LB {
   // Check to see if workbook, so can leave out matrix books
   if(2 == exist(%h,2))
   {
     // Declare range using column name of c100
     range ry=col(c100);
     // Use plotxy X-function to add plot to specified layer
     plotxy iy:=ry plot:=200 ogl:=rGly;
   }
}
// Can use legend update XF so legend shows data range for example;
win -a Graph1;
legendupdate mode:=dr;
Go to Top of Page

szailer

USA
10 Posts

Posted - 09/17/2009 :  08:21:49 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
thanks a lot, very helpful.
in an another topic I also found a command:
Graph1!layer.include(Book1_c)

Tamas Szailer
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