View Raw SPL
/*****************************************************************************
* *
* GETSYMBOLOFFSET.SPL Copyright (C) 2011 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Returns the starting point of a symbol plot *
* *
* Revisions: 31 Jan 2011 RRR Creation *
* *
*****************************************************************************/
#include
#if @HELP_GETSYMBOLOFFSET
GETSYMBOLOFFSET
Purpose: Returns the start sample for a symbol plot.
Syntax: GETSYMBOLOFFSET(series, item)
series - Optional, a series. Defaults to current window
item - Optional, an integer. The series number if the
target is a Window with more than one series.
Defaults to 1.
Returns: An integer, the symbol starting sample number.
Example:
W1: 1..20;setsym(14);setsymbolinterval(5);setsymboloffset(3)
symoff = getsymboloffset(w1)
W1 contains a 20 point series where a circle is used as a
symbol plotted every 5 points starting a the 3rd point
symoff == 3
Remarks:
The SYMBOLOFFSET only takes effect if SYMBOLINTERVAL > 1.
See Also:
Getsymbol
Getsymbolinterval
Getsymbolsize
Setsymbol
Setsymbolinterval
Setsymboloffset
Setsymbolsize
#endif
/* get symbol offset */
getsymboloffset(ser, item, member)
{
local s, offset;
(s, item, member) = getsymboloffset_parse_args(ser, item, member);
if (isscalar(s))
{
if (s == 0)
{
/* current window */
offset = (length > 0) ? getsymbol(2, item, member) : 0;
return(offset);
}
else
{
s = castwindow(s);
}
}
/* return offset */
offset = (length(s) > 0) ? getsymbol(s, 2, item, member) : 0;
return(offset);
}
/* parse args */
getsymboloffset_parse_args(s, item, member)
{
local winnum = 0;
if (argc < 3)
{
if (argc < 2)
{
if (argc < 1) s = refwindow(w0);
item = -1;
}
member = -1;
}
if (isscalar(s))
{
member = item;
item = s;
winnum = 0;
}
else if (iswindow(s))
{
winnum = getwnum(s);
}
else if (isarray(s))
{
winnum = refseries(s);
}
if (member < 0) member = 1;
if (item < 0) item = 1;
return(winnum, item, member);
}