CPlotView:SetIndex CPlotView:Add

CPlotView:GetIndex


The GetIndex method returns the index of the current plot series in the CPlotView.

Syntax

nSeries = CPlotView:GetIndex()

    On success, this method returns nSeries > 0.

    On failure, this method returns 0.

Remarks

A plot window can show all series at once if in over-plot mode, or it can display only the current series in animation mode. Therefore, changing the current series does not affect the appearance of the plot window if the window is in over-plot mode.

Example

The following script fragment plots some points in different series of a CPlotView. It then sets the index back to the first series and returns some information about the current series:

 

V = CPlotView:new()

-- create a CPlotView

V:Add( 25, 66.5)

-- add a point to the data array

  ...

-- 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 a new data array

V:AddSeries()

-- plot the point as a new series

V:Add( 32, 100.75)

-- add 1 point to a new data array

V:AddSeries()

-- plot the point as a new series

V:SetIndex(1)

-- go back to series 1

n = V:Count()

-- number of plot series

c = V:GetIndex()

-- index of current series

Printf( "n=%d, cur=%d", n,c)

-- result: n=3, cur=1

Related Topics

CPlotView, SetIndex