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