View Raw SPL
/*****************************************************************************
*                                                                            *
*   GETNUMFOCUS.SPL  Copyright (C) 2011 DSP Development Corporation          *
*                               All Rights Reserved                          *
*                                                                            *
*   Author:       Randy Race                                                 *
*                                                                            *
*   Synopsis:     Returns the number of overlay foci                         *
*                                                                            *
*   Revisions:    22 Mar 2011  RRR  Creation                                 *
*                                                                            *
*****************************************************************************/


#if @HELP_GETNUMFOCUS

    GETNUMFOCUS

    Purpose: Returns the number of overlay foci.

    Syntax:  GETNUMFOCUS(win)

              win - Optional. A Window, the source Window. Defaults to the
                    current Window.

    Returns: An integer, the total number of overlays (foci) in a Window.

    Example:
             W1: integ(gnorm(1000, 1))
             W2: integ(gnorm(1000, 1))
             W3: W1;overplot(w2, lred)
             W4: W1;overlay(w2, lred)

             f1 = getnumfocus(w3);
             f2 = getnumfocus(w4);

             f1 == 1
             f2 == 2

             W3 contains a series and an overplot.  W4 contains a
             series and an overlay.  Although W3 contains two series,
             there is only one focus, i.e.  no overlay so f1 == 1. 
             Because W4 contains an overlay, f2 == 2 indicating there
             are two foci in W4.

    Remarks:
             See OVERPLOT and OVERLAY for methods to plot multiple series in
             a single window.

    See Also:
             Focus
             Getfocus
             Numitems
             Overlay
             Overplot
#endif


/* returns the number of foci */
getnumfocus(w)
{
        local n;

        if (argc < 1) w = refwindow(w0);

        n = getfocus(w, -1);

        return(n);
}