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
 Set "Horizontal Step" for multiple curves

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
newuser_ca Posted - 08/21/2012 : 3:43:41 PM
OriginPro 8.6 in Win7.

Hi,

I want to set "horizontal step" in my plot.
I used the following codes to set one curve:

Tree trPlot;
trPlot.Root.Curves.Curve1.Line.Connect.nVal = 6; // step Horizontal, 0 offset
if( 0 == gl.UpdateThemeIDs(trPlot.Root) ) // if no err
{
gl.ApplyFormat(trPlot, true, true);
}



If I have multiple curves, how do I set it dynamically?
Is there a way to loop into each curve to set the horizontal step?
2   L A T E S T    R E P L I E S    (Newest First)
newuser_ca Posted - 08/22/2012 : 09:18:03 AM
Hi Penn,

Thanks a lot.

I figured out another way to do it.

int iPlot;
DataPlot dp;
iPlot = gl.AddPlot(dr, IDM_PLOT_LINE);
dp = gl.DataPlots(iPlot);
string strCmd2;
strCmd2.Format("set %s -l 11;", dp.GetDatasetName());
gl.LT_execute(strCmd2);


Penn Posted - 08/21/2012 : 10:30:31 PM
Hi,

I think there are two possible situations for your case. The first one is that all your curves are independent from each other (not grouped). For this, you can try

foreach(GraphLayer gl in gp.Layers)  // loop all graph layers in the graph page, gp is GraphPage
{
	foreach(DataPlot dp in gl.DataPlots)  // loop all data plots in the graph layer
	{
		Tree trPlot;
		trPlot.Root.Line.Connect.nVal = 6;  // set horizontal
		if(0 == dp.UpdateThemeIDs(trPlot.Root))  // if no err
		{
			dp.ApplyFormat(trPlot, true, true);  // set format
		}
	}
}

If the data plots are grouped together in the graph layer, you can refer to the following code.

GroupPlot gplot = gl0.Groups(0);  // get the first grouped plots
Tree trPlot;
trPlot.Root.Line.Connect.nVal = 6;  // set horizontal
if(0 == gplot.UpdateThemeIDs(trPlot.Root))  // if no err
{
	gplot.ApplyFormat(trPlot, true, true);  // set format
}


Penn

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