XGraph

From STX Wiki
Jump to navigationJump to search

XGraph : CObjEx

A class used by XPlot to access graph items.

XGraph Construction

Initialize a new XGraph instance.

Usage:

XGraph xplot row col

Parameters:
xplot
The XPlot instance id to attach this graph to.
row
The row to attach this graph to.
col
The column to attach this graph to.
Result:

A new XGraph object if successful or an empty string.

XGraph Member Functions

The XGraph class implements the following member functions. See CObjEx Member Functions for a list of functions implemented in the parent class.

addmetasegment

Adds a metasegment to an existing graph or redraws all metasegments.

Usage:

inst addmetasegment type [ ; x ; y ; mssettings ; text ; textsettings ]

Parameters:
type
If set to 1, all the metasegments are redrawn, otherwise, no redraw takes place.
x
The left and right position of the metasegment in the following format:
xmin xmax
y
The top and bottom position of the metasegment in the following format:
ymin ymax
mssettings
The metasegment style settings in the following format:
mode style linewidthy linecolor fillmode fillcolor
See the graph item metasegment documentation for details.
text
The text to display in the metasegment.
textsettings
The text settings in the following format:
textcolor horizontalAlign verticalAlign
See the graph item metasegment documentation for details.
Result:

If successful, the metasegment id.

Examples:

Redraw all metasegments in the graph:

<code>$#xgraph addmetasegment 1</code>

addplot_parameter

Add a parameter plot to the existing graph.

Usage:

inst addplot_parameter y ; ; ; ; ; ; ; ; fstyle ;

Parameters:
y
Either a table or a value item containing a matrix of values.
fstyles

addplot_xyplot

Usage:

xgraph ADDPLOT_XYPLOT y ; x ; ; ; ; ; ; ; ; fstyles ;

Parameters:
y
fstyles

applysettings

Apply the current settings to the graph.

Usage:

inst applysettings key

Parameters:
key
One of the following keywords:
all|profile|flags

deletemetasegments

Deletes all metasegments in the graph.

inst deletemetasegments

get

Get a graph attribute.

Usage:

inst get attr

Parameters:
attr
The attribute to get. The following attributes are supported:
GRAPH TYPE RANGE CURSORMODE CURSORPOSITION XDATA YDATA XUNIT YUNIT XTEXT YTEXT TITLE XPLOT ROW COLUMN
Result:

The attribute's value or an empty string.

legend

Displays a function legend for xyplot and parameter plots.

Usage:

inst legend unit ; x ; y ; w ; h ; tcolor ; info ; args

Parameters:
unit
One of the following values:
real|%|percent
x
The x position specified as values of unit unit.
y
The y position specified as values of unit unit.
w
The width as specified as values of unit unit.
h
The height as specified as values of unit unit.
tcolor
The text color.
info
One of the following values:
color|all
args
Either a table with one text line per entry, or a blank separated list of words.

msdelete

Delete metasegments from the graph.
Usage:

inst msdelete [ cmd ]

Parameters:
cmd
One of the following keywords:
selected - deletes selected metasegments.
all - deletes all metasegments.
By default, selected metasegments are deleted.

msghandler

Overrides CObj msghandler. Implements the message handler for this graph and it's cursors.

Usage:

inst msghandler type name id par

Parameters:

See CObj::msghandler for details.

Result:

Returns 1

msinsert

Insert a metasegment into the graph, prompting user for input via a dialog.

Usage:

inst msinsert

play

Play

Usage:

inst play [ mode ]

Parameters:
mode
If 1, play the whole range of the graph. Otherwise play the range between the cursors.

plot_parameter

Plots a parameter plot.

Usage:

inst plot_parameter y ; title ; xrange ; xunit ; xtext ; yrange ; yunit ; ytext ; fstyles ; xlabtab ; ylabtab

Parameters:

See XPlot::plot for details.

plot_spectrogram

Plots a spectrogram plot.

Usage:

inst plot_spectrogram d ; y ; title ; xrange ; xunit ; xtext ; yrange ; yunit ; ytext ; zrange ; xlabtab ; ylabtab

Parameters:

See XPlot::plot for details.

plot_textbox

Plots a box with text in it.

Usage:

inst plot_textbox title ; color ; halign ; valign ; textargs

Parameters:

See XPlot::Plot for details.

plot_waterfall

Plots a 3D waterfall plot.

Usage:

inst plot_waterfall d ; x ; title ; xrange ; xunit ; xtext ; yrange ; yunit ; ytext ; zrange ; zunit ; ztext ; xk ; yk ; nl ; xlabtab ; ylabtab ; zlabtab

Parameters:

See XPlot::Plot for details.

plot_waveform

Plots a waveform plot.

Usage:

inst plot_waveform wave ; title ; xunit ; xtext ; full ; ymax ; ytext ; fill ; xlabtab ; ylabtab

Parameters:

See XPlot::Plot for parameter details.

plot_xyplot

Plots an X/Y plot.

Usage:

inst plot_xyplot y ; x ; title ; xrange ; xunit ; xtext ; yrange ; yunit ; ytext ; fstyles ; xlabtab ; ylabtab

Parameters:

See XPlot::Plot for details.

redraw

Redraw the graph. This function does not support waveform plots.

Usage:

inst redraw

set

Sets graph attributes.

Usage:

inst set attr argv

Parameters:
attr
Either one of the following keywords:
cursormode, cursorposition, yrange, xunit, yunit, xtext, ytext or title
Or an integer between 1 and 7.
argv
If attr is one of cursormode, cursorposition, yrange, xunit, yunit, xtext, ytext or title, then argv should supply the following values:
mode type line bind func
Where they can have the following values:
mode - off|on
type - cross|crosshair|vbarcross|harmonic
line - off|on
bind - off|on
func - a zero-based index to set the current function
If attr is 1, then the cursor position and selected state is set and argv should supply the following values:
index x y selected
If attr is 2, then the y-scale of the graph can be set, and argv should supply the following values:
ymin ymax
If attr is greater than 2, then the unit, text or title can be set, and argv should supply the relevant text:
attr=3 - xunit
attr=4 - yunit
attr=5 - xtext
attr=6 - ytext
attr=7 - title

setflag

Toggles the associated flags.

Usage:

inst setflag cmd

Parameters:
cmd
One of the following commands:
CMODE - turns the cursor on/off

CSTYLE - rotates through available cursor styles CBIND - binds/unbinds the cursor to the function CBINDNEXT - binds the cursor to the next available function CBINDPREV - binds the cursor to the previous available function CLINE - turns the cursor line on/off TITLE - turns the title on/off XSCALE - rotates through available x-scale positions YSCALE - rotates through available y-scale positions ZSCALE - rotates through available z-scale positions

setupdialog

Displays the graph's setup dialog.

Usage:

inst setupdialog

setwave

Set the wave item for this graph.

Usage:

inst setwave [ masterwaveitem ]

Parameters:
masterwaveitem
The wave item which this graph should address. If no masterwaveitem parameter is specified, the current wave item (if any) is deleted.
Result:

0 on success, non-zero on failure.

stopplayback

Stops playback.

Usage:

inst stopplayback

updateContextMenu

Updates the context menu, reflecting any changes that have been made to the graph.

Usage:

inst updateContextMenu

zoom

Zoom into or out of the graph.

Usage:

inst zoom xin|xout|yin|yout

inst zoom zin|zout

inst zoom x|y|xy

inst zoom toggle

inst zoom reset

Parameters:
xin|xout|yin|yout
Zoom in or out around the active cursor.
zin|zout
Change the spectrogram floor.
x|y|xy
Zoom between the cursors.
toggle
Toggle between zoom 'overview' and 'view' mode.
reset
Reset the zoom (zoom out completely).

Navigation menu

Personal tools