3.3.6 Plot XY from Different Worksheet


Version Info

Minimum Origin Version Required: Origin 8 SR0

Example

This example shows plot XY columns from different worksheet.

We introduced DataRange class from Origin8. One data range can be the entire worksheet, unconnected columns, partial data of one column or data from different worksheet.

void plot_xy_from_diff_wks()
{
	DataRange dr;
	dr.Add("X", "[Book1]Sheet1!A:A");
	dr.Add("Y", "[Book1]Sheet2!C:C");	
	
	GraphPage gp;
	gp.Create("origin", CREATE_HIDDEN);
	GraphLayer gl = gp.Layers(0);
	gl.AddPlot(dr, IDM_PLOT_SCATTER);
	gl.Rescale();
	gp.SetShow();
}