CPlotView:SetIndex


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

Syntax

bSuccess = CPlotView:SetIndex( nSeries )

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

bullet.gif    On success, this method returns true

bullet.gif    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 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 = new_plotview()

-- create a CPlotView

V:Add( 25, 66.5)

-- add a point to the internal data matrix

  ...

-- 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 internal data matrix

V:AddSeries()

-- plot the point as a new series

V:Add( 32, 100.75)

-- add 1 point to a new internal data matrix

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


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