CPlot:FindNearest
The FindNearest method returns the plot series index of the point nearest the target coordinates (x,y).
nIndex, xPt, yPt = CPlot:FindNearest( x, y ) |
nIndex is the index of the nearest point, from 1 to CPlot:Count.
x is the x coordinate of the target point.
y is the y coordinate of the target point.
xPt is the x coordinate of the nearest point.
yPt is the y coordinate of the nearest point.
On failure, 0,0,0 is returned.
The following script finds the index of the point nearest coordinates (4.2,-17.1) in series 1 of a CPlotView:
|
-- select the target plot window |
|
-- if not successful, exit the script |
|
-- get a CPlot object for series 1 |
|
|
|
-- get index n and coordinates |
|
-- print the result |
Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024
Mirametrics, Inc. All Rights Reserved.