1.18.3 Picking Points from a Graph
GetGraphPoints class is used to pick points from the curve on the Graph window. This class has virtual methods to allow the user to derive from it to overload methods.
The Origin C
The following example shows how to use the GetGraphPoints class to pick two points from a Graph.
// Set as true , the cursor moves along the DataPlot and picks points from
// the curve.
// Set as false, the cursor does not move along the DataPlot, and picks
// points from the screen.
// To pick point from the specified Graph by GraphLayer object(gl)
int nPts = 2; // the number of the points to pick
// Get the x/y data and indices from the picked points
vector vx, vy;
vector<int> vnPtsIndices, vnPlotIndices;
if( mypts.GetData(vx, vy, vnPtsIndices, vnPlotIndices) == nPts )
for(int ii = 0; ii < vx.GetSize(); ii++)
printf("point %d: index = %d, x = %g, y = %g, on plot %d\n",
ii+1, vnPtsIndices[ii], vx[ii], vy[ii], vnPlotIndices[ii]+1);