CPlotView:CountSeriesPoints


The CountSeriesPoints method returns the number of points in a plot series of the CPlotView. If the series is not specified, then the current series is used.

Syntax

nPoints = CPlotView:CountSeriesPoints( series=nil )

bullet.gif    series is the index of the plot series, in the range 1 to CountSeries. If not specified or nil or 0, the current plot series is used.

bullet.gif    On success, this method returns nPoints > 0.

bullet.gif    On failure, this method returns 0.

Remarks

Note that there are two protocols for adding data to a CPlotView: adding individual points from the class data matrix or adding data from the rows of a CMatrix. If using the CMatrix method, note that this protocol plots all point between the minimum and maximum column indices in the row. Since the CMatrix is sparse, the number of points actually stored in the row may be smaller than the number of points in the plot series. See the second example, below.

Example

Example 1. The following script plots some points in 2 plot series of a CPlotView. It then returns the number of points plotted in the first series:

 

V = new_plotview()

-- create a CPlotView

V:Add( 25, 66.5)

-- add a point to the plot data

  ...

-- add 99 more points

V:PlotPoints()

-- plot 100 points in a new plot window

V:Empty()

-- empty all the points

V:Add( 20, 51.4)

-- add 1 point to the plot data

V:AddSeries()

-- plot the point as a new series

n = V:CountSeriesPoints(1)

-- points in series 1

Printf( "n1 = %d", n)

-- result: n1 = 100

 

 

Example 2. The script below shows how the sparse properties of the CMatrix result in more points being plotted than are stored in the CMatrix:

 

V = new_plotview()

-- create a new CPlotView

M = new_matrix()

-- create a CMatrix

M:Set( 4, 12, 10.2 )

-- add point at row 4, column 12.

M:Set( 4, 20, 7.8 )

-- add point at row 4, column 20.

P:PlotMatrixRange(M,4,4)

-- plot CMatrix row 4 (entered as 4 to 4)

n = V:CountSeriesPoints()

-- number of points plotted

Printf("nSeries = %d", n)

-- result: nSeries = 9

Related Topics

CPlotView class, CMatrix


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