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
 Forum for Origin C
 How to produce mass of pictures acoording to txt's
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

ytyyutianyun

48 Posts

Posted - 02/18/2012 :  05:46:06 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
I use the origin 7.5

the data name is 1.txt(can be changed)

And the picture will be follow:

the text "node 1" is acoording to the name of txt "1"
xlabel and ylabel and increment is fixed
And the axis is fixed also.
How to do it. Thanks

ytyyutianyun

48 Posts

Posted - 02/18/2012 :  05:50:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Go to Top of Page

Penn

China
644 Posts

Posted - 02/19/2012 :  10:38:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can get the data name when you import the data. Here, I assume there is already a text object on the graph. Then you can refer to the following code. In Origin 7.5, it will be much easier to use LabTalk command to handle the axis format, so, the LT_execute function is used.

void textobject_75()
{
	GraphLayer glMyLayer("Graph1");  // the graph name "Graph1"
	GraphObject goMyObj = glMyLayer.GraphObjects("Text");  // get the text object, need to know the text object name
	goMyObj.Text = "Node" + "1";  // set text
	
	GraphObject goXTitle = glMyLayer.GraphObjects("XB");  // get the bottom x title
	goXTitle.Text = "x" + "1";   // set text

	GraphObject goYTitle = glMyLayer.GraphObjects("YL");  // get the left y title
	goYTitle.Text = "y" + "1";  // set text
	
	string strCmd = "layer.x.inc = 5;";  // x increment
	strCmd += "layer.y.inc = 5;";  // y increment
	strCmd += "layer.x.from = -2.5;";  // x from
	strCmd += "layer.x.to = 22.5;";  // x to
	strCmd += "layer.y.from = -2.5;";  // y from
	strCmd += "layer.y.to = 22.5;";  // y to
	
	LT_execute(strCmd);  // execute the LabTalk command
	
	glMyLayer.GetPage().Refresh();  // refresh the graph
}


Penn
Go to Top of Page

ytyyutianyun

48 Posts

Posted - 02/19/2012 :  10:56:39 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
your code is based on the fact that I have made the picture
But the more thing is that I want to produce mass of pictures

I have try some ex.

First,I open all the txts' and save the picture template

and save the code to tp.ogs
[main]
	
doc -cw adata; // count test worksheets
loop(i,1,8) {

win -a a	data$(i); // activate next wks

wks.col$(1).type=4; // make this column X (correction)
wks.col$(3).type=1; // make this column Y (correction)

%W=%H; // save wks name

win -t p "www\LINE.otp"


lay -a;

layer.x.from = 0;
layer.x.to = 800;
layer.x.inc = 100;
};


run.section(Graph,MergeAllPages);


But then nothing happen what's wrong?

Thanks
Go to Top of Page

Penn

China
644 Posts

Posted - 02/20/2012 :  12:11:48 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The script is in the section [main]. Maybe you can try this command:

run.section(tp.ogs, main);


Penn
Go to Top of Page

ytyyutianyun

48 Posts

Posted - 02/20/2012 :  02:19:17 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
I have tried and nothing happen also
May be something wrong in my program
Go to Top of Page

ytyyutianyun

48 Posts

Posted - 02/20/2012 :  06:51:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
win -a adata$(3)


I have some idea of problem.
May be I have not active the window, have I ?
Can you give me some hints or modified
Thanks

Edited by - ytyyutianyun on 02/20/2012 8:28:46 PM
Go to Top of Page

ytyyutianyun

48 Posts

Posted - 02/20/2012 :  06:53:07 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The data are from several worksheet.
And I want to plot the figure each worksheet.
each worksheet using the 1st column(x axis)and the 3rd column(y axis)
Go to Top of Page

Penn

China
644 Posts

Posted - 02/20/2012 :  8:47:24 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

You can use the document -e W command to loop all worksheets in the project, and the worksheet -s and worksheet -p can be used to select columns and plot them respectively. For example:

document -e W {
	worksheet -s 3 0 3 0;  // select the thhird column
	worksheet -p 200 Line.otp;  // plot the third column
}


Penn
Go to Top of Page

ytyyutianyun

48 Posts

Posted - 02/21/2012 :  02:25:21 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks ,I have got the answer.
Go to Top of Page

WaltieL

Russia
1 Posts

Posted - 03/11/2012 :  07:15:41 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi all.

I have the same problem (creation of many pictures). And the question is: how can i add the title on the picture?

In the example the title is already on the picture. So, what i suppuse to do is to change text property.

But what if i created GraphPage programmatically without any template and it is clear? I added curves, change lines properties, turned on TopTicks and RightTicks. But how can i add the title on the picture?

I tried this:

Tree trFormat;
GraphLayer gl = Project.GraphPages("Graph1").Layers(0);

trFormat.Root.Axes.X.Titles.TopTitle.show.nVal = 1;
if(0 == gl.UpdateThemeIDs(trFormat.Root)) { gl.ApplyFormat(trFormat, true, true); }

trFormat.Root.Axes.X.Titles.TopTitle.AddNode("Text").strVal = "TopTitle";
if(0 == gl.UpdateThemeIDs(trFormat.Root)) { gl.ApplyFormat(trFormat, true, true); }

Both conditions returns "true", but both ApplyFormat() returns "false".

How to turn on TopTitle, or add text to GraphPage?
Go to Top of Page

greg

USA
1379 Posts

Posted - 03/12/2012 :  2:01:49 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
To WaltieL:

Theme properties only can be applied to existing objects with those properties. You cannot simply create a branch of a theme and create an object.

See
http://ocwiki.originlab.com/index.php?title=OCGuide:Creating_and_Accessing_Graphical_Objects
for examples that create various GraphicObjects and position them in relation to the axes scales.

Edited by - greg on 03/12/2012 2:02:18 PM
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