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
 All Forums
 Origin Forum for Programming
 Forum for Origin C
 How to set the x-offset for the plot in OriginC?

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
dmwhite Posted - 11/14/2012 : 04:23:43 AM
Help me!
How to set the x-offset for the plot in OriginC?

dsqw!
4   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 11/16/2012 : 04:42:24 AM
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
dmwhite Posted - 11/16/2012 : 04:33:56 AM
Try to understand :-)
Thank you!

To rest is to rust!
folger Posted - 11/15/2012 : 7:07:08 PM
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.
dmwhite Posted - 11/15/2012 : 07:41:11 AM
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!

The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000