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
 Set "Horizontal Step" for multiple curves
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

newuser_ca

70 Posts

Posted - 08/21/2012 :  3:43:41 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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?

Penn

China
644 Posts

Posted - 08/21/2012 :  10:30:31 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

newuser_ca

70 Posts

Posted - 08/22/2012 :  09:18:03 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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);


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