CPlotView:GetIndex


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

Syntax

nSeries = CPlotView:GetIndex()

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

bullet.gif    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 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 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 a new set of plot data

V:AddSeries()

-- plot the point as a new series

V:Add( 32, 100.75)

-- add 1 point to a new set of plot data

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


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