Given DataPlot data index range and get corresponding data point values.
Get data points that are inside the enclosed graphic object.
int GetDataPoints( int nrFrom, int nrTo, vector& vx, vector& vy, vector& vz = NULL, vector& vErr = NULL, DWORD dwCntrl = 0, int nPts = 800 ) int GetDataPoints( OriginObject & obj, vector & vx, vector & vy, vector<int> * pIndeces = NULL, DWORD dwCtrl = 0 )
Number of non-NANUM values if success. NANUM values are stored in the various vectors. Negative error codes are returned if error.
number of data points found or < 0 for error codes
EX1
void DataPlot_GetDataPoints_Ex1() { //make sure there exists a graph with dataplots on it before running this code. GraphLayer gl = Project.ActiveLayer(); if ( gl ) { DataPlot dp = gl.DataPlots(0); //get the first dataplot on graphlayer if ( dp ) { vector vX, vY; dp.GetDataPoints(0, -1, vX, vY); vector<string> vsX, vsY; convert_double_vector_to_string_vector(vX, vsX, vX.GetSize()); convert_double_vector_to_string_vector(vY, vsY, vY.GetSize()); string strXData, strYData; strXData.SetTokens(vsX, ','); strYData.SetTokens(vsY, ','); printf("All X points in dataplot is : %s\n", strXData); printf("All Y points in dataplot is : %s\n", strYData); } } }
EX2
// For this example to run, a graph window must exist in the project. // Also, the active layer in the Graph should have a graphic object (such as rectangle) with // the name "Rect" which covers some data points void DataPlot_GetDataPoints_ex2() { // Create and attach a graph layer from current Graph: GraphLayer gl = Project.ActiveLayer(); DataPlot dp = gl.DataPlots(0); //get the first dataplot on graphlayer if ( dp ) { GraphObject grobj = gl.GraphObjects("Rect"); vector vX, vY; vector<int> vnIndeces; dp.GetDataPoints(grobj, vX, vY, &vnIndeces); vector<string> vsX, vsY; convert_double_vector_to_string_vector(vX, vsX, vX.GetSize()); convert_double_vector_to_string_vector(vY, vsY, vY.GetSize()); string strXData, strYData; strXData.SetTokens(vsX, ','); strYData.SetTokens(vsY, ','); printf("All X points in dataplot is : %s\n", strXData); printf("All Y points in dataplot is : %s\n", strYData); } }
origin.h