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