Attached a layer in an Origin graph window to the object based on the graph name and the layer index.
BOOL Attach( LPCSTR lpcszWinName, int nLayerNum = -1 )
TRUE for success, otherwise FALSE.
EX1
// For this example to run, a graph window must exist in the project. // Make sure that the window has at least two layers. // Make layer 2 active before running the function. void GraphLayer_Attach_ex1() { // Construct a GraphLayer object and attach it to the second layer of the current window. // (note that in the constructor the layer index is 0-offset, so the // first layer needs index 0) GraphLayer gl(Project.GraphPages(0).GetName(), 1); // Display the index of the layer in graph page // (note that the index returned from the "GetIndex" method // is 1-offset, so the first layer will have index 1): out_int("Layer index = ", gl.GetIndex()); // Now attach the first layer: gl.Attach(Project.GraphPages(0).GetName(), 0); // Display the index of the layer in graph page. // (note that the index returned from the "GetIndex" method // is 1-offset, so the first layer will have index 1): out_int("Layer index = ", gl.GetIndex()); }
origin.h