The jar library CompositeWaveDisplay.jar contains a set of Java classes providing support for Web-based data visualization. The same classes are also used by a native library (JavaMds) to provide a callable interface to data visualization. It is therefore possible to integrate waveform display in user-written applications.

I Using CompositeWaveDisplay as an Applet

Currently the applet provided in CompositeWaveDisplay.jar supports visualization for signals in Jet, TWU and every experiment using MdsPlus.

The applet activation requires the installation of the JVM-plug-in in the browser. An easy way to create the HTML code is to use the HTML converter, as follows:

  1. Create an HTML page using the <APPLET> tag:

  2. <APPLET CODE = "CompositeWaveDisplay.class" ARCHIVE = "CompositeWaveDisplay.jar" WIDTH = "700" HEIGHT = "500" NAME = "CompositeWaveDisplay" ALIGN = "baseline">

    the applet can be configured by means of the following parameters:

    AUTENTICATION: the password required for accessing signals

    SIGNAL_1, .. SIGNAL_N: the list of signals to be displayed. Each signals definition is composed of the following parts defining the location of the signal data and the position of the corresponding plot panel in the (multipanel) applet window:

    url = signal source definition


    row = row position of the panel in which plot the signal

    col = column position of the panel in which plot the signal

    color = signal color in exadecimal format 0xRRGGBB

    name = signal name (which will be displayed in the legend)

    marker = signal marker (0 = none, 1 = square, 2=circle, 3=cross, 4=triangle, 5=point)

    for example:

    <PARAM NAME = "SIGNAL_1" VALUE = " url = mds://\emra_it row = 1 col = 1 color = 0xaf0000">

    <PARAM NAME = "SIGNAL_2" VALUE = " url = mds://\emra_it row = 2 col = 1 color = 0xaf0000">

  3. Download the HTML converter from

  4. After the conversion, the resulting HTML definition can be used both in Netscape and Iexplore.

  5. If there are security applet problems , the policytool program of the JRE distribution can be used to trust the signal server data source.


II Using CompositeWaveDisplay from a C/C++ program


The shared library JavaMds (part of the MdsPlus distribution) provides a set of routines for initializing the Java Virtual Machine from a native application, creating windows and plotting signals:

void createWindow(char *name, int idx)
//Creates a new CompositeWaveDisplay window with title name index idx
//The given value for idx represents the uonique identifier of the window and has to be used in the subsequent calls.

void clearWindow(char *name, int idx)
//Clear all signal shown by the window identified by idx and set the new title to name

void showWindow(int obj_idx, int x, int y, int width, int height)
//Show the window identified by idx at location (x,y) with (width height) dimension

void addSignal(int idx, float *x, float *y, int num_points
       int row, int column, char *colour, char *name)

//Add a new signal signal into the window identified by idx at panel (row, column)
//the signal is defined by the x and y float vectors and the number of points is given by num_point
// color defines the associated color
// colors: ("Black", "Blue", "Cyan", "DarkGray","Gray", "Green", "LightGray", "Magenta", "Orange", "Pink", "Red", "Yellow")
//name : an optional signal name (to be shown in the associated legend)

void addSignalWithParam(int idx, float *x, float *y, int num_points,int row,
                        int column,char *colour, char *name, int inter,  int marker)

//Same as addSignal, plus the following parameters:
//inter : if not zero a line is draw between points
//marker : draw a marker in each point (0 = none, 1 = square, 2=circle, 3=cross, 4=triangle, 5=point)


An example

The following fragment of code displays a sinusoidal function:

float y[100];

float x[100];

int n_points = 100;

int i;

//Create the window with identifier 0

createWindow("Test", 0);

// initialize x y vectors to the signal value to plot

for(i = 0; i < 100: i++)


    x[i] = i * 3.14/100;

    y[i] = sin(x[i]);


//add the signal to waveform panel (1,1) using black color and
//"sine" legend name

addSignal(0, x, y, n_points, 1, 1, "black", "test");

//Show the window

showWindow(0, 50,50, 500, 500);


III Using CompositeWaveDisplay from TDI


A set of TDI function has been created to display waveforms by means of TDI calls. The TDI functions have the same meaning of the above C routine:

FUN PUBLIC JavaNewWindow(in _label, in _idx)
creates a new window

FUN PUBLIC JavaClearWindow(in _label, in _idx)
Clears the window

FUN PUBLIC JavaAddSignal(in _idx, in _y, optional _opt_x, optional _opt_row, optional _opt_col,                            optional _opt_color, optional _opt_label)
Adds a new signal to the window

FUN PUBLIC JavaShowWindow(in _idx, in _x, in _y, in _width, in _height)
Displays the window