CPlot:GetY


The GetY method returns the y value of the point at an index in a plot series.

Syntax

y, success = CPlot:GetY( nIndex )

bullet.gif    nIndex is the index of the plot series, from 1 to CPlot:Count.

bullet.gif    y is the y value of the point.

bullet.gif    success is a boolean value and is true if the index is valid. This second argument may be omitted if the index is known to be valid.

bullet.gif    On failure 0,false is returned.

Example

The following script gets the y value of the 15th point in plot series 1 of a CPlotView on the Mira desktop:

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

 

nIndex = 15

-- choose the point at index 15

y, success = P:GetY( nIndex )

-- get the y value at nIndex

if success then

 

  Printf("y[%d]=%lg\n", nIndex, y)

-- print the results

else

 

  Printf("Index %d is out of range\n", nIndex)

-- bad index

end

 

Related Topics

CPlotView class, CPlot class, GetX, GetXY, GetPt


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