CPlot:FindNearestX CPlot:GetPt

CPlot:FindNearestY


The FindNearestY method returns the plot series index of the point with y coordinate nearest a target y value.

Syntax

nIndex, yPt = CPlot:FindNearestY( y )

bullet.gif    nIndex is the index of the nearest point, from 1 to CPlot:Count.

bullet.gif    y is the y coordinate of the target point.

bullet.gif    yPt is the y coordinate of the nearest point.

bullet.gif    On failure, 0,0 is returned.

Example

The following script finds the index of the point with y coordinate nearest -17.1 in series 1 of a CPlotView:

V = attachlist_plotview()

-- select the target plot window

if V == nil then Exit() end

-- if not successful, exit the script

P = V:GetPlot(1)

-- get a CPlot object for series 1

if P == nil then Exit("Bad series") end

 

nTargY = -17.1

-- find the point nearest y=-17.1

n, yPt = P:FindNearestY( nTargY )

-- get index n and value y

Printf("Nearest: Pt[%d]=%lg\n", nTargY, n, yPt)

-- print the result

Related Topics

CPlotView class

CPlot class

FindNearest

FindNearestX

 


Mira Pro x64 Script User's Guide, v.8.73 Copyright Ⓒ 2024 Mirametrics, Inc. All Rights Reserved.