CPlot:FindNearestX
The FindNearestX method returns the index in a plot series of the point with x value nearest a target value.
nIndex, x = CPlot:FindNearestX() |
nIndex is the index of the plot series, from 1 to CPlot:Count.
x is the x value of the point.
On failure, 0,0 is returned.
The following script finds the index of the point with x value nearest 4.2 in series 1 of a CPlotView on the Mira desktop:
|
-- 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 results |
CPlotView class, CPlot class, FindNearestY
Mira Pro x64 Script User's Guide, Copyright Ⓒ 2024 Mirametrics,
Inc. All Rights Reserved.