CPlotView:CountSeries CPlotView:GetIndex

CPlotView:SetIndex


The SetIndex method changes the current plot series index to a specified value.

Syntax

bSuccess = CPlotView:SetIndex( nSeries )

    nSeries is the series index in the range 1 to Count.

    On success, this method returns true

    On failure, this method returns false.

Remarks

A plot window shows all series simultaneously in over-plot mode, or it displays only the current series in animation mode. Therefore, if the plot window is in over-plot mode, changing the current series does not affect the appearance of the window.

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, GetIndex