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
 Create Floating Graph in Script After Import
 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 - 11/17/2012 :  10:26:28 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
OriginPro Student 9.0.0, Win 7-64bit (running under WMware Fusion 5.0.2)

Using a "Script After Import" in an import filter, I'd like to create a graph and then add it to the worksheet containing the imported data (I'm using a workbook template). I have the graph creation code working (see below) but need help with the code to add the graph to the worksheet.

plotxy (4,5) plot:=200 ogl:=[<new template:=MyTemplate name:=MyGraphName>] legend:=0 rescale:=1 hide:=1;

Any thoughts?

Drbobshepherd

USA
Posts

Posted - 11/19/2012 :  11:06:47 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
cdrozdowski111,

Use insertgraph to embed your graph into a cell in the worksheet. You may need to add a column first. Also, before creating the graph, I suggest saving the workbook and worksheet names because you may need them to address the cell.

Good luck.

DrBobShepherd
Go to Top of Page

greg

USA
1378 Posts

Posted - 11/21/2012 :  12:00:21 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
For 9.0 users who want the new floating graph there is a new function:

string MyGraph;
insert_graph_to_layer igname:=Graph2 ogname:=MyGraph; // NEW

The worksheet on which you want the floating graph should be active when the command executes.

You can use this code to (approximately!) position the graph to the right of the last column:
%(MyGraph$).x=bmp.dx/2+wks.ncols;
%(MyGraph$).y=-bmp.dy/2;
Go to Top of Page

cdrozdowski111

USA
247 Posts

Posted - 11/21/2012 :  5:03:32 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks Greg, you're a doll!

I'll play with it and post a detailed example so that others might find it and be helped.
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