Hi,
This is possible with Origin C code such as below, where a curve object is first constructed using datasets from two different worksheets and then is added as a plot to a layer programmatically.
To test this code, first create two worksheets with names data1 and data2 and then fill the first column of each with some numbers (try filling with numbers other than just 1, 2, 3 to make sure you see the correct plot). Then compile and link this code and type the function name in script window and hit Enter.
Easwar
OriginLab
void plot_test()
{
// Declare a curve object with X data coming from 1st col of data1 wksheet
// and Y data from 1st col of data2 wksheet
Curve crv("data1_a", "data2_a");
// Create a new graph page and plot this curve
GraphPage gpg;
gpg.Create();
// Point to layer 1 of this graph
GraphLayer gly = gpg.Layers(0);
// Add the curve as a plot in this layer
gly.AddPlot(crv);
// Rescale the layer
gly.Rescale();
}
P.S. I am using hard coded names here to construct the curve which is not recommended - you could look at other curve constructors. Also, once plotted, as long as you are looking at layer contents, things will work fine. I tried fitting etc to the curve and it worked fine. Plot Setup may have problems in correctly interpreting the relationship between the datasets from two different worksheets.