View Raw SPL
/*****************************************************************************
* *
* STRIPCHART.SPL Copyright (C) 2007 DSP Development Corporation *
* All Rights Reserved *
* *
* Author: Randy Race *
* *
* Synopsis: Overlays multiple series in a stripchart fashion *
* *
* Revisions: 27 Feb 2007 RRR Creation *
* 1 Mar 2007 RRR color support *
* *
*****************************************************************************/
#include
#if @HELP_STRIPCHART
STRIPCHART
Purpose: Overlays multiple series with separate stacked scales.
Syntax: STRIPCHART(s1, ..., sN, altscales, gap, xgrid, ygrid, dir, color1, ... colorN)
sN - Optional. One or more series to stack. Defaults
to the series in the current window.
altscales - Optional. An integer, the scales location.
0: left side of window (default)
1: alternate left and right sides
gap - Optional. A real bewteen 0 and 100. The
percentage gap between each overlay. Defaults
to 0.0, no gap.
xgrid - Optional. An integer, the X grid style for
each overlay.
-1: inherit current window style (default)
0: no grids
1: solid
2: dashed
3: dotted
ygrid - Optional. An integer, the Y grid style for
each overlay. Defaults to XGRID.
-1: inherit current window style
0: no grids
1: solid
2: dashed
3: dotted
dir - Optional. An integer, the stacking order.
0: bottom-up (default)
1: top-down
colorN - Optional. A list of integers, the color for each
series. Defaults to -1, each series automatically
set to a different color. If only one color is
specified, all the series are set to that color.
Returns: Nothing, the series are displayed as a stacked stripchart.
Example:
W1: stripchart(gnorm(100,1), integ(gnorm(100,1)), 10..80)
W1 contains a stripchart of 3 series spaced equally apart.
Example:
W1: stripchart(gnorm(100,1), integ(gnorm(100,1)), 10..80, 1, 10, 3, 3, 0, lblue)
Same as above accept the scales alternate, a 10 percent gap is
inserted between each overlay, dotted grids are displayed and
each series is plotted in light blue.
Example:
W1: stripchart(gnorm(100,1), integ(gnorm(100,1)), 10..80, 1, 10, 3,3)
W2: integ(w1);stripchart(1, 10, 3, 3, 1, lblue, lgreen, purple)
W1 contains a 3 trace stripchart. W2 integrates each trace and
displays a stripchart with alternating scales, a 10 percent gap,
dotted grids and the primary trace appears at the top of the graph.
The color of the third trace is set to purple.
When W1 changes, W2 will automatically integrate each series in
W1 and display the result in W2 as a stripchart.
Remarks:
STRIPCHART can operate on a list of input series as shown
in the first example. STRIPCHART can also be used to set
a plot style as part a Window formula (shown in W2 of the
last example) or on a standalone basis.
STRIPCHART uses SPANY and SETY to arrange the series as
overlays with separate, stacked scales.
If no colors are specified, each series is automatically
plotted in a different color.
If only one color is specified, all series are plotted in
that color.
STRIPCHART also works with XY series. For example:
a = xy(1..100, gnorm(100, 1));
b = integ(a);
c = deriv(a);
W1: stripchart(a, b, c);
The X plotting range is set to the minimum and maximum of all
the traces.
See Also:
Setyauto
Spany
Staggery
#endif
/* create a stripchart display */
stripchart(argv)
{
local s;
if (outargc > 0)
{
/* return stripchart series */
s = setstripchart(argv);
return(s);
}
else
{
/* add stripchart to current window */
setstripchart(argv);
}
}