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