The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to set the x-offset for the plot in OriginC?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

dmwhite

Ukraine
3 Posts

Posted - 11/14/2012 :  04:23:43 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Help me!
How to set the x-offset for the plot in OriginC?

dsqw!

dmwhite

Ukraine
3 Posts

Posted - 11/15/2012 :  07:41:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Surely no one faced this problem?

I use "trFormat.Root.Stack.X.nVal=true",
but as an offset to specify a specific plot not know.

Help me please!


To rest is to rust!
Go to Top of Page

folger

China
6 Posts

Posted - 11/15/2012 :  7:07:08 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Dima:

Set dataplot x/y offset is not supported by Origin C. You can try using Labtalk ( Origin9.0 needed ):

void SetPlotStackOffset(DataPlot& dp, double xOfffset, double yOfffset)
{
	GraphLayer gl;
	dp.GetParent(gl);
	
	BOOL bX = !is_missing_value(xOfffset);
	BOOL bY = !is_missing_value(yOfffset);
	
	string strLTLyaerOffset;
	strLTLyaerOffset.Format("layer -b s 4 %d %d;", bX ? 1 : 0, bY ? 1 : 0);
	
	string strMainData = dp.GetDatasetName();
	string strLTPlotXOffset;
	string strLTPlotYOffset;
	
	if ( bX )
		strLTPlotXOffset.Format("set %s -sx %f;", strMainData, xOfffset);
	if ( bY )
		strLTPlotYOffset.Format("set %s -sy %f;", strMainData, yOfffset);
	gl.LT_execute(strLTLyaerOffset + strLTPlotXOffset + strLTPlotYOffset);
}

void test_SetPlotStackOffset()
{
	Worksheet wks;
	wks.Create("Origin");
	
	Dataset dsX(wks, 0);
	Dataset dsY(wks, 1);
	dsX.Data(1, 10);
	dsY.Data(1, 10);
	
	XYRange xy;
	xy.Add(wks, 0, "X");
	xy.Add(wks, 1, "Y");
	
	GraphPage gp;
	gp.Create("Origin");
	
	GraphLayer gl = gp.Layers();
	plot_data_range(xy, gl, IDM_PLOT_LINE, GAP_GROUP_PLOTS | GAP_USE_TEMPLATE | GAP_ALLOW_DUPLICATE_COL, NULL, true);
	
	DataPlot dp = gl.DataPlots();
	SetPlotStackOffset(dp, 2, 4);
}


Folger
Originlab Corp.

Edited by - folger on 11/15/2012 7:16:59 PM
Go to Top of Page

dmwhite

Ukraine
3 Posts

Posted - 11/16/2012 :  04:33:56 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Try to understand :-)
Thank you!

To rest is to rust!
Go to Top of Page

Penn

China
644 Posts

Posted - 11/16/2012 :  04:42:24 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

The key things in the code are two LabTalk commands, you can refer to the LabTalk document on layer -b, and set name -sx for more details.

Penn
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000