Minimum Origin Version Required: Origin 8 SR0
Following function arrange_all_graphs_into_one_graph shows how to copy graph layer from one page to another page and arrange multiple layers in one page using Origin C code.
Before run arrange_all_graphs_into_one_graph need to prepare a clear project without any graph window and then run prepare_graphs function to create multiple graphs firstly or prepare graphs that want to arrange in one graph yourself.
void prepare_graphs() { string strFile = GetAppPath(TRUE) + "Samples\\Curve Fitting\\Multiple Gaussians.dat"; ASCIMP ai; if(0 == AscImpReadFileStruct(strFile, &ai)) { Worksheet wks; wks.Create(); if( 0 == wks.ImportASCII(strFile, ai) ) // returns 0 on success { // loop all xy and plot each one in the separate graph window int nXIndex = 0; for(int nYIndex = 1; nYIndex < wks.GetNumCols(); nYIndex++) { GraphPage gp; gp.Create("Origin"); GraphLayer gl = gp.Layers(); // get active layer Curve crv(wks, nXIndex, nYIndex); gl.AddPlot(crv); gl.Rescale(); } } } } void arrange_all_graphs_into_one_graph() { // copy layers from the graphs in vsGraphPages GraphPage gpAll; gpAll.Create(); int nNumLayers = 0; foreach(GraphPage gp in Project.GraphPages) { if( gp.GetName() != gpAll.GetName() ) { GraphLayer gl = gp.Layers(); gpAll.AddLayer(gl); nNumLayers++; } } GraphLayer glEmpty = gpAll.Layers(0); // remove the first layer that already existed when page created glEmpty.Destroy(); // arrange layers to N * 1 int nNumRows = nNumLayers, nNumCols = 1; page_arrange_layers(gpAll, nNumRows, nNumCols); // Combine all legends to a single legend on the first layer. int iLegendLayer = 0; //the index of the layer on which to put the combined legend; bool bAscending = true; //sort the legends ascending before combine into one legend legend_combine(gpAll, iLegendLayer, bAscending); }