CPlot:ToTable


The ToTable method creates an array containing PlotPoint tables, one for each point in the plot series. Alternatively, the properties of one point may be obtained using the GetPt method.

Syntax

tbl = CPlot:ToTable()

bullet.gif    where tbl is an array of PlotPoint tables (see below).

bullet.gif    On failure, nil is returned.

Example

The following script attaches a CPlotView from the Mira desktop and prints the point data for plot series 1:

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

 

tbl = P:ToTable()

-- convert the plot series to a table

if tbl == nil then Exit("table is nil") end

 

-- print the PlotPoint table for every point in plot series 1:

 

Printf("Index, (x,y), (xe,xe), stat, vis\n")

-- print a table heading

for n = 1, #tbl do

-- for each index of tbl

  t = tbl[n]

-- assign the n-th point to name "t"

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

 

         n, t.x, t.y, t.xe, t.ye, t.status, t.visible)

-- print all properties of the point

end

 

Related Topics

CPlotView class, CPlot class, GetPt, PlotPoint table


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