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
 Plot skip points and change y question

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
kwis2 Posted - 11/18/2012 : 6:46:39 PM
Hi
I have a lot of plots, and I would like to format every plot depends on dataset.
With colour and points it is easy by tree, but I have problem with data, where I would like to skip points, like in the drop lines in plot properties menu. I am no able to find the way how to set this property.

Best regards
Kamil
2   L A T E S T    R E P L I E S    (Newest First)
Penn Posted - 11/19/2012 : 12:48:59 AM
Hi Kamil,

1. About skipping points, you can use the LabTalk command set %C -skip n. For example:

string strCMD;
int nSkipPoints = 4;  // skip points is 4
strCMD.Format("set %s -skip %d;", dp.GetDatasetName(), nSkipPoints);  // dp is the data plot object
gl.LT_execute(strCMD);  // execute the LabTalk command, gl is the graph layer of the data plot

2. To change Y, please refer to the following sample code.

// Arguments:
// const string strNewData: the name of the new data
// int nPlotIndex = -1: the index of the plot in the layer to be changed data
void test_changeplotdata(const string strNewData, int nPlotIndex = -1)
{
	GraphLayer glActive = Project.ActiveLayer();  // get the active graph layer
	if(!glActive)
	{
		out_str("Error, please the active window is graph.");
		return;
	}

	DataPlot dp = glActive.DataPlots(nPlotIndex);  // get the data plot by index
	if(!dp)
	{
		out_str("Error, not found data plot by index.");
		return;
	}
	if( nPlotIndex < 0 ) // -1 means active plot index, need to convert to real index
		nPlotIndex = dp.GetIndex();

	Tree trContents;
	glActive.GetLayerContents( trContents, GETLC_DATAPLOTS );	// get layer contents tree
	TreeNode trLayer = trContents.GetNode( "Layer" + glActive.GetIndex() ); // layer tree node, the index offset is 0 here
	if( !trLayer )
	{
		out_str("Error");
		return;
	}
		
	string strName = "DataPlot" + (string)( nPlotIndex + 1 ); // the index offset is 1 here
	TreeNode trDataPlot = trLayer.GetNode(strName);	  // data plot tree node
	if( trDataPlot )
	{
		TreeNode trDepData = trDataPlot.PlotDesigs.DPC1;
		if( trDepData && trDepData.Name )
		{   	
			trDepData.Name.strVal = strNewData;  // replace with the new data name
			DWORD dwAddPlotsCtrl = ADDPLOTSFROMTREE_EDIT|ADDPLOTSFROMTREE_IMPLICIT_STYLEHOLDERS;
			int nNewPlotNum = glActive.AddPlots( trContents.FirstNode, dwAddPlotsCtrl );
		}
	}
}


Penn
kwis2 Posted - 11/18/2012 : 7:06:54 PM
Sorry for reply on my own post, I wasn't able to edit my post :(

Another part of question It is how could I change "Y" on plots. I mean I would like to change ploted data for instance from column 3 to 4 of worksheet by one click. I have tried XYRange but I have failed.

Best regards
Kamil

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