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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 simple layout

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ovince Posted - 07/06/2006 : 06:14:38 AM
hi All

I would like to create Layout with 6 or 8 graph objects but I could not learn much about this from
Origin's manual. Colud someone help me?

Actually, I have about 50 graphs in Origin and I would like to make about 8 Layouts with 6 or more graph objects of the same size in OC


Thanks many in advance

Oliver
4   L A T E S T    R E P L I E S    (Newest First)
ovince Posted - 07/14/2006 : 11:24:24 AM
hi

Thank you Deanna. I have just tryed the code you wrote and it works. I am very happy. Manu many thanks :)

Oliver
Deanna Posted - 07/10/2006 : 05:26:12 AM
Hi, Oliver. Maybe the following OC program can help to arrange your graphs into different layers.


/**
Create some new graphs with multiple layers to arrange the graphs existed in
the project. Note that the old graphs are assume to contain only one layer
Parameters:
None.
Returns:
the count of objects
Example:
//The original project contain 50 graphs. The following function creates 6 new
//graphs which have 3 columns and 3 rows to arrange the old graphs, and deletes
// the old ones.
void test()
{
test4940(3, 3);

}
*/

void test4940(int Col, int Row)
{
int iOriGraphCount=Project.GraphPages.Count(); //Current number of graphs in project

int iLayersPerPage; //Number of layers per page
iLayersPerPage = Col * Row;

if (iLayersPerPage<iOriGraphCount)
{
printf("Not enough layers to arrange the graphs");
return;
}

int iNewGraphCount;
iNewGraphCount = (iOriGraphCount - 1) / iLayersPerPage+1;

//Customize margins and gaps
int iLeft=10;
int iRight=10;
int iTop=10;
int iBottom=10;
int iHorizontalGap=5;
int iVerticalGap=5;

//Calculate the width and height for each layer
int iLayerWidth = (100-iLeft-iRight-iHorizontalGap)/Col;
int iLayerHeight = (100-iTop-iBottom-iVerticalGap)/Row;

int ii, jj, kk;
int iIndex=0;
for (ii=0; ii<iNewGraphCount; ii++)
{
GraphPage gpNew;
gpNew.Create("origin");

for (jj=0; jj<Row; jj++)
{
for (kk=0; kk<Col; kk++)
{
if (iIndex==iOriGraphCount) break;

if (jj!=0 || kk!=0) gpNew.AppendLayers("origin");

GraphLayer glNew=gpNew.Layers(jj*Col+kk);

//Format the layer
string strScript;
strScript.Format("layer.height=%d", iLayerHeight);
glNew.LT_execute(strScript);
strScript.Format("layer.width=%d", iLayerWidth);
glNew.LT_execute(strScript);
strScript.Format("layer.left=%d", iLeft+kk*(iLayerWidth+iHorizontalGap));
glNew.LT_execute(strScript);
strScript.Format("layer.top=%d", iTop+jj*(iLayerHeight+iVerticalGap));
glNew.LT_execute(strScript);

//Add dataplots to the new layer
GraphPage gpOld=Project.GraphPages(iIndex++);
GraphLayer glOld=gpOld.Layers(0);
DataPlot dp=glOld.DataPlots(0);
Curve cc(dp);
DataPlot dp2=glOld.DataPlots(1); //Error bar
Curve cc2(dp2);

glNew.AddPlot(cc);
glNew.AddPlot(cc2);
glNew.Rescale();

}
}
}
}


However, this function ignores the formats of the original graphs. Probably, you can improve yourself this function so that it can better suit your need.

Deanna
OriginLab GZ Office
ovince Posted - 07/08/2006 : 09:48:56 AM
hi

Thanks Larry for helping me. Sorry for delayed reply

Well, I have about 50 worksheets. All are the same (with 3 columns; x, y and y error). Than I wrote a smal routine in Origin C that makes 50 graphs. Now I would like to put graphs onto layout to be nicely arranged for publication :)

I am not good in LabTalk. How to join graphs to layers that your Script makes?

Thanks again
Oliver



larry_lan Posted - 07/07/2006 : 12:30:35 AM
Hi Oliver:

Does your graphes associated with some data worksheet? If your graph is ploted from some datasource, it is better to plot the graph on different layers of the page. Here is a LabTalk Scripts to arrange 3*2 layers on a page:


nLayers=6; //Number of Layers
%P=MyPlot;
win -t plot origin %P; //Create a new graph page
nn=nLayers-1;
repeat nn
{
page -L layer;
plot -L;
} //Generate multiple layers on the page

width=20;
height=30; //Layer width and height
cc=1;rr=0;
nCol=3;nRow=2;
win -a %P;
for (ii = 1; ii <= nLayers; ii++)
{
cc=mod(ii,nCol);
cc=cc==0?3:cc;
rr=cc==1?(rr+1):rr;
layer -s ii;
layer width height (8+(cc-1)*(width+12)) (10+(rr-1)*(height+10)); //Arrange layer.
};



Larry
OriginLab GZ Office

Edited by - larry_lan on 07/07/2006 12:35:30 AM

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000