CPlot:GetX


The GetX method returns the x value of the point at an index in a plot series.

Syntax

x, success = CPlot:GetX( nIndex )

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

bullet.gif    x is the x 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 x 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

x, success = P:GetX( nIndex )

-- get the x value at nIndex

if success then

 

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

-- print the results

else

 

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

-- bad index

end

 

Related Topics

CPlotView class, CPlot class, GetY, GetXY, GetPt


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