SET GRAPH
See GRAPH Item Attributes for a list of graph item attributes.
A graph consists of eight splitters. It has one X input (which is not always used), a user-defined number of Y inputs and a CURSOR output. Each Y input can be used to display a function (for some functions, in combination with the X input). All splitters in a graph and all functions displayed in a graph use the same X and Y scale settings. Each function is assigned to one splitter in which it should be displayed. More than one function can be displayed in one splitter. The functions displayed in a splitter can even be different but they should be compatible (e.g. it makes no sense to assign a SPECTROGRAM
and a WAVEFORM
to the same splitter). Each splitter can be set to be visible or hidden.
For all color settings (and palettes) used by a graph, one color can be assigned for the screen and one for the printer. To assign screen colors use the commands as described above. For printer color setup use the same commands a second time with the option /Print.
To minimize screen updates, most setup commands do not directly affect the display. The setup parameters are stored and must be explicitly transferred to the display. For this purpose the option /Apply
can be used with any graph-item command.
The formats and values for color and font arguments used in the graph commands are described in detail in the Colors and Color Arguments topic in the General section.
Contents
- 1 Inputs and plots
- 2 Configuration & Control
- 3 Cursors
- 4 Context Menus
- 5 Print
- 6 Metasegments & Markers
- 7 Selections
Inputs and plots
Graphs items can display different types of function plots. The function data is passed to the graph via the graph's X and Y inputs. You set up the relationship between the data (a value item, SPU, or GDX file) and the graph's inputs using the following SET graph X
and SET graph Y
commands.
Connecting graph inputs
Configure a graph's x and y axis for data input.
SET graph X data
The graph item's X
command configures a graph's x-axis data input. The exact configuration necessary depends on the type of plot which will be drawn.
SET graph Y index data function splitter params /R
The graph item's Y
command configures the graph's y-axis data input. The function parameter specifies which type of plot will be drawn. These plots are described individually in more detail below.
option | description |
---|---|
index | The zero-based input index (0…inputs–1) |
data | data parameter. This can be the output of an SPU (spuitem.output) or of a value item (valueitem). |
function | One out of XYPLOT , PARAMETER , WATERFALL , SPECTROGRAM and WAVEFORM .
|
splitter | The number of the graph splitter index (1..8) where the function should be displayed. Note that splitter visibility is set using the SPLITTERS command.
|
params | The function plot configuration parameters (see the specific plot below). |
/R | The real-time option /R causes the function to be re-displayed each time an input is updated. |
The Y input MUST be defined before the X input on the first call (redefining the Y axis once both x and y inputs have been defined is not a problem). Orienting a graph (e.g. rotating 90 degrees) is achieved with the command SET graph ORIENTATION
. Use of the options /Horizontal and /Vertical is no longer supported.
Disconnecting graph inputs
SET graph Y index SET graph X
Disconnect any inputs previously assigned to the graph's input index.
option | description |
---|---|
index | The index of the input (0…nInputs-1). |
Outputs are automatically disconnected if the item owning the output or the graph item itself is deleted.If the connection is synchronized (e.g. the connected SPU item is still running) disconnection is not possible.
Plots
The STx graph item can draw a number of different plot types.
XYPLOT
SET graph Y index yout XYPLOT splitter color style line width sym [/F=noPlotValue] [/Realtime]
Display a two-dimensional function plot: Yi = f(Xi). The outputs assigned to the X and Y inputs must be vectors of the same length. The option /F=noplot
can be used to suppress plotting all the points where Yi equals noplot (useful for f0-tracks). If the option /Realtime
is used, the function is redisplayed each time an input is updated. Otherwise, the function is displayed on synchronisation (when the SPU stops). The DASH
and DOT
line styles only support widths of 0
.
option | description |
---|---|
xout | The x data vector (an output of an SPU ). This must be the same length as yout.
|
yout | The y data vector (an output of an SPU ). This must be the same length as xout.
|
colour | The color of the function line (either a color name or an RGB code). |
style | The plot style. Either dotted (POINTS ), a line (LINES ), a solid area (AREA ) or no line (NONE ).
|
line | The line style (SOLID , DASH or DOT ).
|
width | The width of the function line (0 -4 if line is SOLID , 0 if line is DOT or DASH ).
|
sym | The symbol to use at each parameter (NONE , SQUARE , TRIANGLE , CIRCLE , CROSS or DIAMOND ).
|
F=noPlotValue | Use this option to suppress a particular value (noPlotValue) from the plot |
SET graph X xout
Assign the X input vector. The X input vector must be the same length as the Y input vector. The Y input vector must be set before calling this command.
PARAMETER
SET graph Y index yout PARAMETER splitter nfrm color style line width [/F=noplot /Realtime]
Display the Y data as a function of time (frame index). The connected output can be a numeric value or a vector. Each value written to Y is appended to the time track. The options /F and /R have the same meaning as for XYPLOT
. This function is used to display parameter time tracks in (frame-by-frame) analysis applications. The DASH and DOT line styles only support widths of 0
.
option | description |
---|---|
yout | The parameter values (one number per frame). |
nfrm | The number of frames (parameter values). If real-time mode is specified (/R), this is the number of frames per screen. |
color | The line color (color name or rgb code). |
style | The plot style (POINTS , LINES , AREA,STEPS ).
|
line | The line style (SOLID , DASH , DOT ).
|
width | The line width (0 .. 4 – SOLID, 0 – DASH/DOT)
|
See Connecting graph inputs for parameters not described here.
No X input connection is necessary. The X (time) scale is defined by the number of frames nfrm specified for the Y data.
WATERFALL
SET graph Y index yout WATERFALL splitter nfrm nspectra lcolor fcolor style width [/Realtime] SET graph X xout
The output connected to X contains the frequency values, and the output connected to Ynum contains the magnitude values. Both must be vectors of the same length. The X scale is written only once.
option | description |
---|---|
yout | The waveform samples (a vector or a number). |
splitter | The splitter to show the function in. |
nfrm | The number of frames. |
nspectra | The number of spectra to display. |
lcolor | The line color (color name or rgb code). |
fcolor | The fill color (color name or rgb code). |
style | DASH |DOT ).
|
width | The width of the function line (0 -4 ).
|
See Connecting graph inputs for parameters not described here.
SPECTROGRAM
SET graph Y index ydata SPECTROGRAM splitter nframes amin amax palette [ /R ]
The output connected to Ynum contains the values (magnitude, phase, ..) to be displayed in colors. The Y vector must be the same length as the X vector. The Y values are converted to colors and either displayed each time the input is updated (if the real-time option /R is specified), or on synchronization (when the SPU stops). The whole spectrogram consists of nfrm spectra. The colours used to display the different amplitudes are defined using the palette parameter.
option | description | ||||||
---|---|---|---|---|---|---|---|
ydata | Either an SPU output or a GDX file item providing the magnitude vectors (1 spectrum / frame). | ||||||
nframes | The number of frames (spectra). If the /R option is specified, this parameter determines the number of frames displayed at any one time on screen. | ||||||
amin, amax | The minimum and maximum magnitudes. | ||||||
palette | The extended table containing the RGB color values (the color palette). The table must have three integer or number fields 'R', 'G' and 'B' where each row defines one RGB value (each field entry may be a value from 0 to 255). The maximum number of palette table entries is 256. You can change the palette at any time by calling this function with a new palette table.
Mapping of y values to colors, with: i = 0 … nrgb-1; da = (amax – amin) / nrgb
|
See Connecting graph inputs for parameters not described here.
SET graph X xdata
The data output connected to X supplies the frequency values. The X vector must be the same length as the Y vector. The X scale is written only once. Note that the frequency scale is displayed on the y axis (time is displayed on the x axis).
option | description |
---|---|
xdata | The frequency vector (only set once). |
- Zooming in a spectrogram
- You can zoom into a spectrogram graph on three axes: time (x), frequency (y) and amplitude (z). Zooming is done using the scale commands
XSCALE
,YSCALE
andZSCALE
.
WAVEFORM
SET graph Y index yout WAVEFORM splitter nsmp color style scroll [ /R ]
The waveform envelope is drawn using a min/max plot and optionally filled (style=AREA
). Each screen contains nsmp samples of the waveform, and the waveform is scrolled if more than nsmp samples are sent via the input Ynum. The argument scroll can set to OFF
(or 0
) if scrolling should be avoided. The output connected to Ynum can be a vector (of any length) or a number. If the option /R is used, the function is redisplayed each time an input is updated. Otherwise, the function is displayed on synchronisation (when the SPU stops).
option | description |
---|---|
yout | The waveform samples (a vector or a number). |
nsmp | The number of samples per screen. |
color | The line color (color name or rgb code). |
style | The plot style (LINES , AREA ).
|
scroll | 1 ) or disable scrolling (OFF |0 ).
|
See Connecting graph inputs for parameters not described here.
Note that you must apply the settings to the graph (option /A
) before synchronizing the inputs if the input data is to be correctly interpreted.
Configuration & Control
Configure the colours and layout of the graph.
AXIS
SET graph AXIS xLabel yLabel labelFont labelColor xTitle yTitle titleFont titleColor xUnit yUnit xBorder yBorder
Configure the X and Y axis. If you are using a WATERFALL
graph, you can configure the Z axis with the ZSCALE
command.
option | description |
---|---|
xLabel | The position of x labels (OFF , ABOVE . BELOW or BOTH ).
|
yLabel | The position of y labels (OFF , LEFT , RIGHT or BOTH ).
|
labelFont | The label font. |
labelColor | The label color. |
xTitle | The position of x axis text (OFF , ABOVE , BELOW or BOTH ).
|
yTitle | The position of y axis text (OFF , LEFT , RIGHT or BOTH ).
|
titleFont | The title font. |
titleColor | The color for titles. |
xUnit, yUnit | Display x and y axis units (OFF or ON ) .
|
xBorder, yBorder | The width of the border at the edge of the window on the x axis and y axis (in pixels). The default is 1 .
|
BGCOLOR
SET graph BGCOLOR text draw
Set background colors for the text and draw regions of a graph.
option | description |
---|---|
text | background color for text regions |
draw | background color for draw regions |
FRAME
SET graph FRAME xscale yscale scalecolor grid gridcolor xsteps ysteps major minor
Configure the graph's frame, scale and grid. Note if you can use the graph item commands XSCALE
, YSCALE
and ZSCALE
to set the scale, grid and tick values.
xscale | draw x scale (OFF , ABOVE , BELOW or BOTH )
|
yscale | draw y scale (OFF , LEFT , RIGHT or BOTH )
|
scalecolor | color for scales |
grid | draw grid (OFF , X , Y or BOTH )
|
gridcolor | color for grid |
xsteps, ysteps | number of minor x/y ticks between labels |
major, minor | size of major/minor ticks in pixels |
Note that the difference between a major and a minor grid is the line style: a major grid is solid, whilst a minor grid is dashed.
ORIENTATION
SET graph ORIENTATION rotation flip
Set the orientation of the graph. By default, the x axis is the horizontal axis and runs from left to right, whilst the y axis is the vertical axis and runs from bottom to top. You can use the ORIENTATION
command to rotate the graph and flip the direction in which the axes run. The XSCALE
and YSCALE
commands can also modify a graph's flip settings.
option | description | ||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
rotation | The angle in degrees by which to rotate the graph. Only the values 0 , 90 , 180 and 270 are supported. An asterisk (* ) can be passed to retain the current rotation setting.
The rotation can also be specified thus: | ||||||||||||||||||||||||||||||||||||||||||||
flip | Determines whether the graph should be flipped on the x and y axis. The following values are supported:
Note that you can retrieve the current orientation of a graph using the attribute OVERVIEWSET graph OVERVIEW [ mode ] Switch between 'overview' and 'view' modes. In the 'overview' mode, the whole range of the graph is displayed with the current 'view' displayed as a metasegment. In the 'view', only the range of the current view is displayed. Moving the view metasegment whilst in the 'overview' mode will result in a new view, once back in the 'view' mode.
You can query which mode the graph is in using the See also XSCALE and YSCALE. SPLITTERSSET graph SPLITTERS splitter1 [splitter2 ...] [/Merge] Set splitters to be displayed. A graph can contain up to eight splitters. Usually only two are used for, e.g., displaying a stereo signal. If /Merge is specified, the currently displayed splitters remain active, otherwise only the specified splitters are displayed.
Display the first two splitters. $#graph splitters 1 2 TITLESET graph TITLE mode font color [title1 title2] [/Settitle] Configure and/or set graph title. The option /Settitle can be used to set a new graph title without applying other settings.
XSCALESET graph XSCALE min max unit text [formatStr|table] [/Invert] [/Log] [/View] SET graph XSCALE [ min max ] /View Set the x scale range, title and unit string.
If the option /View is specified, the min and max value are used to display a section of the whole range. If Reset is specified (e.g. /View=Reset), the min/max values are ignored (and can be left out) and the whole range is redisplayed.
YSCALESET graph YSCALE min max unit text [formatStr|table] [/Invert] SET graph YSCALE [ min max ] /View=[Reset] Set the y scale range, title- and unit-string.
If the option /View is specified, the min and max value are used to display a section of the whole range. If Reset is specified (e.g. /View=Reset), the min/max values are ignored and the whole range is redisplayed.
ZSCALE
Set the z scale range, title- and unit-string. Note that the z scale was introduced with the implementation of the Waterfall graph. The values xShrink and yShrink determine that amount of the available space for the graph is taken up with the x and y axis.
If the option /View is specified, the min and max value are used to display a section of the whole range. If Reset is specified (e.g. /View=Reset), the min/max values are ignored and the whole range is redisplayed.
scale definition tableThe graph item commands
CursorsSTx graph items support two graphical cursors, which can be used to mark points on a graph. See Cursors for an introduction to the concept of cursors. CURSORMODE
Configure the graph cursors' visibility and functionality. One of the options /Graph, /Shell or /Both can be used to define the handling of the special graphic keys (cursor keys and some function keys). See Cursors for a general description of STx cursor functionality.
PLAYCURSOR
Set position and configuration of the play cursor. The play cursor is a cursor whose position is set by this command and cannot be changed interactively by the user. It is used, for instance, to display the running cursor during signal playback (in this case the position is controlled by a timer).
CURSORPOS
Set the position of a cursor and optionally select (/Select) or deselect it (/Deselect). The value y is only needed if the cursor is not function bound.
Context MenusADDPOPUP
Define the contextmenu items of a graph. One contextmenu can be added to each graph. If a contextmenu is already defined, it can be replaced with When a context menu item is selected by the user, a SETPOPUP
Actives|deactivate and/or set or clear the check status of menu items. DELETEPOPUP
Removes the items defined by the user, leaving the default context menu item 'Copy / Print ...'.
Copy to clipboard
Save to file filename
Print to paper. Print or save the graph. The options /Print and /Screen are used to select the color scheme (see the Notes below). For file output, the file format is selected by the options /Enhancedmetafile (*.WMF), /Bitmap (*.BMP) or /pnG (*.PNG). Once started, the operation is performed in the background and a Metasegments & MarkersDELETEMARKER
Delete all segment/label markers from the graph.
Delete all metasegments (no msid specified) or the metasegment with id msid. As synonym for MARKERSSET graph MARKERS mode auto font color msfont mslincol msfillcol mstextcol Assign settings for markers and metasegments. The settings for metasegments are just default values and can be overwritten when creating a metasegment.
ADDMARKERThe graph item's A marker can display a string and point. A segment can display a line between two points and a string. A metasegment can display a line or box and a string, and can be clicked and moved. All of them support the following options:
Add a marker. Parameters not described here are described below.
Add a segment. If the
H - horizontal bar V - vertical bar
Add or update a metasegment. Metasegments are a way to mark regions of graphs. Some of the advantages of metasegments are:
The metasegment splitter setting are defined by the specified splitter arguments (splitterX) and following options:
Adding a normal metasegment to an existing graph. #t := new table * * /E string:parameter string:string number:number if $#t[?] != table em -1 ; $#mac::error - failed to create table $#t * parameter id string testid $#t * parameter xmin number 20 $#t * parameter xmax number 80 $#t * parameter ymin number 20 $#t * parameter ymax number 80 $#t * parameter caption string this is the text caption $#t * parameter mode string window $#t * parameter linewidth integer 1 $#t * parameter linecol string red $#t * parameter fillmode string filled $#t * parameter fillcol string green $#t * parameter halign string center $#t * parameter valign string center $#t * parameter splitters string 1 2 $#t * parameter style string box $#g addmarker $#t /Redraw Here is an example of a box and whiskers metasegment to an existing graph. #t := new table * * /E string:parameter string:string number:number if $#t[?] != table em -1 ; $#mac::error - failed to create table $#t * parameter id string testid $#t * parameter xmin number 20 $#t * parameter xmax number 80 $#t * parameter ymin number 20 $#t * parameter ymax number 80 $#t * parameter caption string this is the text caption $#t * parameter mode string window $#t * parameter linewidth integer 2 $#t * parameter linecol string red $#t * parameter halign string center $#t * parameter valign string center $#t * parameter splitters string 1 2 $#t * parameter valueaxis string x $#t * parameter style string boxandwhiskers $#t * parameter min number -20 $#t * parameter max number 75 $#t * parameter mean number 45 $#t * parameter median number 55 $#t * parameter iqrmin number 35 $#t * parameter iqrmax number 65 $#t * parameter unit string dB $#g addmarker $#t /Redraw Selections"Selections" can be used to mark polygon areas of a graph. A selection can be moved and redrawn by the user using the mouse. Selections are created, modified and deleted using the graph command
First implemented in STx 3.10 Activating and deactivating selectionsSELECTION ACTIVATE
Activate the selection identified by id. If SELECTION DEACTIVATE
Deactivate the selection identified by id. Creating selectionsSELECTION SET
Creates a new selection, or changes the polygon of an existing selection.
Deleting selectionsSELECTION DELETE
The
Listing existing selectionsSELECTION LIST
The tList
// example #tList := new table * * /e string:id string:splitters string:boundrect if '$#tList[?]' != 'table' em -1 ; $#mac::ERROR - failed to create #tList table $#graph SELECTION LIST $#tList showitem $#tList ; contents of 'list' table
Modifying default and existing selection settings.You can modify the way an existing selection looks and behaves using the SELECTION SETTINGS
Set the default settings for all new selections, modify all selections in one go, or modify an existing selection's settings. The settings which can be modified include a selection's color, it's transparency, any text it should display, and which graph splitters it should be visible in.
// set default settings for all selections Retrieving a selectionSELECTION GET
Retrieves the selection's current polygon.
|