Author |
Topic |
|
ytyyutianyun
48 Posts |
Posted - 02/18/2012 : 05:46:06 AM
|
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
|
|
|
|
Penn
China
644 Posts |
Posted - 02/19/2012 : 10:38:23 PM
|
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 |
|
|
ytyyutianyun
48 Posts |
Posted - 02/19/2012 : 10:56:39 PM
|
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 |
|
|
Penn
China
644 Posts |
Posted - 02/20/2012 : 12:11:48 AM
|
Hi,
The script is in the section [main]. Maybe you can try this command:
run.section(tp.ogs, main);
Penn |
|
|
ytyyutianyun
48 Posts |
Posted - 02/20/2012 : 02:19:17 AM
|
I have tried and nothing happen also May be something wrong in my program
|
|
|
ytyyutianyun
48 Posts |
Posted - 02/20/2012 : 06:51:21 AM
|
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 |
|
|
ytyyutianyun
48 Posts |
Posted - 02/20/2012 : 06:53:07 AM
|
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) |
|
|
Penn
China
644 Posts |
Posted - 02/20/2012 : 8:47:24 PM
|
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 |
|
|
ytyyutianyun
48 Posts |
Posted - 02/21/2012 : 02:25:21 AM
|
Thanks ,I have got the answer. |
|
|
WaltieL
Russia
1 Posts |
Posted - 03/11/2012 : 07:15:41 AM
|
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? |
|
|
greg
USA
1379 Posts |
|
|
Topic |
|