cdoc
The GraphWindow encapsulates the object interface to ElVis. Application programs can send data to ElVis using the GraphWindow object.
The GraphWindow object defines the routines and data for defining a grid of graphs. Each cell of the grid contains one graph. A graph contains one or more datasets that are drawn in the plot area.
When a GraphWindow is displayed in ElVis it is drawn in a frame within the desktop window.
The geometric coordinates of a graph are specified between 0. - 1. horizontally and vertically. The origin, 0., 0., is at the lower left corner of the graph. The upper right corner of the graph is 1., 1. The layout of a graph is shown on the ElVis Programming Interface page.
In the C language API to ElVis the subroutine names start with e_ . The API allocates memory to store the GraphWindow before sending it to be displayed. Memory is allocated when the create routines are called (e_GraphWindowCreate, e_GraphCreate, e_DatasetCreate). The memory can be freed when it is no longer needed.
An application uses the API to build up the complete description of a GraphWindow and then send it to the ElVis display program. A typical sequence of calls is:
#include "graphwindow.h" status = e_Initialize(); status = e_Register("rplot", username, hostname, "NSTX-02"); status = e_GraphWindowCreate("NSTX", 3, 2); status = e_GraphCreate("Temperature", E_NO_INDEX); status = e_GraphWindowAddGraph("NSTX", "Temperature", 0, 0); status = e_FxDatasetCreate("Exp 1", nPoints, x, fx); status = e_GraphAddFxDataset("Temperature", "Exp 1"); status = e_GraphSetXLabel("Temperature", "X Axis Label"); status = e_GraphSetYLabel("Temperature", "Y Axis Label"); status = e_GraphSetTitle("Temperature", "Title of Graph"); status = e_GraphWindowDisplay("NSTX"); status = e_End();This creates a GraphWindow with 3 rows and 2 columns. Then a graph is created and put in the leftmost column of the top row. A dataset is created and added to the graph. Then the parameters for the axes are set and a title is specified. Now that the GraphWindow is fully defined the last call is made to send the GraphWindow from the application to ElVis where it will be displayed. The upper left cell will contain the graph. The other 5 cells will be empty, but graphs can be added to them later.
The ElVis subroutines are in the library elvis.a. Application programs should be linked with elvis.a.
Constants | |
int |
E_DATASET_NOT_FOUND
The Dataset could not be found. |
int |
E_DRAW_FAIL
The GraphWindow could not be drawn by ElVis display program. |
int |
E_DRAW_SUCCESS
The GraphWindow was drawn in ElVis display program. |
int |
E_FAIL
Parameters could not be set. |
int |
E_FALSE
|
int |
E_GRAPH_NOT_FOUND
The Graph could not be found. |
int |
E_GRAPH_WINDOW_NOT_FOUND
The GraphWindow could not be found. |
int |
E_LINEAR
The axis increments linearly. |
int |
E_LOGARITHMIC
The axis increments logarithmically. |
int |
E_NO_INDEX
The datasets in the graph are not indexed. |
int |
E_PRINT_FAIL
The graph could not be printed by ElVis display program. |
int |
E_PRINT_SUCCESS
The graph was printed by the ElVis display program. |
int |
E_SEND_FAIL
The GraphWindow could not be sent to ElVis display program. |
int |
E_SUCCESS
Parameters were set successfully. |
int |
E_TIME_INDEX
The datasets in the graph are indexed in time. |
int |
E_TRUE
|
int |
E_VALUE_INDEX
The datasets in the graph are indexed by a value. |
C Subroutine Summary | |
int |
e_CloseWindows(int port)
Close all the GraphWindows. |
int |
e_End()
Terminate the API to ElVis. |
int |
e_FxCreate(char *datasetName,
int points,
double x,
double fx)
Create an f(x) dataset. |
int |
e_FxtDatasetCreate(char *datasetName,
int points,
double x,
double fx,
double time)
Create an f(x) dataset that is indexed. |
int |
e_FxtDatasetDisplay(char *windowName,
char *graphName,
char *datasetName)
Display an additional f(x) dataset that is indexed in time. |
int |
e_GraphAddFxDataset(char *graphName,
char *datasetName)
Add a dataset to the graph (by name). |
int |
e_GraphAddFxDatasetID(char *graphName,
int ID)
Add an indexed dataset to the graph (by ID). |
int |
e_GraphAddLabel(char *graphName,
char *label,
float[] location,
char *font,
char *style,
float size,
float[] color)
Add a label to the graph. |
int |
e_GraphCreate(char *graphName,
int type)
Create a graph. |
int |
e_GraphSetIndexLabel(char *graphName,
char *label)
Specify the text of the Index label. |
int |
e_GraphSetLegend(char *graphName,
float[] location)
Position the legend. |
int |
e_GraphSetPlotArea(char *graphName,
float[] location,
float width,
float height)
Specify the plot area for the graph. |
int |
e_GraphSetTitle(char *graphName,
char *title)
Specify the title of the graph. |
int |
e_GraphSetXAxis(char *graphName,
int loglin)
Specify log/linear for the X axis. |
int |
e_GraphSetXLabel(char *graphName,
char *label)
Specify the label for the X axis. |
int |
e_GraphSetYAxis(char *graphName,
int loglin)
Specify log/linear for the Y axis. |
int |
e_GraphSetYLabel(char *graphName,
char *label)
Specify the label for the Y axis. |
int |
e_GraphShowLegend(char *graphName,
int show)
Draw or hide the legend. |
int |
e_GraphWindowAddGraph(char *windowName,
char *graphName,
int row,
int column)
Add a graph to a GraphWindow. |
int |
e_GraphWindowAddSurface(char *windowName,
char *surfaceName,
int row,
int column)
Add a surface to a GraphWindow. |
int |
e_GraphWindowAppendGraph(char *windowName,
char *graphName,
int growth)
Append a graph to a GraphWindow. |
int |
e_GraphWindowCreate(char *windowName,
int rows,
int columns)
Create a GraphWindow. |
int |
e_GraphWindowDisplay(char *windowName,
int port)
Send the GraphWindow data to ElVis and display it. |
int |
e_GraphWindowFree(char *windowName)
Free memory allocated for a GraphWindow. |
int |
e_GraphWindowPrint(char *windowName,
int row,
int column,
char *fileName,
int port)
Print a graph that is displayed in ElVis. |
int |
e_Initialize()
Initialize the API to ElVis. |
int |
e_Register(char *source,
char *user,
char *host,
char *identifier)
Register the application with the ElVis server. |
int |
e_ShowLines(char *datasetName,
int show)
Control the display of lines between data points. |
int |
e_ShowMarkers(char *datasetName,
int showInterval)
Control the display of data point markers. |
int |
e_SurfaceCreate(char *surfaceName,
char *graphName)
Create a surface from a graph containing an indexed dataset. |
int |
e_SurfaceSetTitle(char *surfaceName,
char *title)
Specify the title of the surface. |
Constants Detail |
Returned by: FxCreate, FxShowLines, FxShowMarkers, GraphAddFxDataset
Returned by: e_GraphWindowDisplay.
Returned by: e_GraphWindowDisplay.
Returned by: e_GraphWindowPrint.
Returned by: e_GraphWindowPrint.
Returned by: many.
Returned by: e_GraphAddFxDataset, e_GraphAddLabel, e_GraphSetIndexLabel, e_GraphSetPlotArea, e_GraphSetTitle, e_GraphSetXAxis, e_GraphSetYAxis.
Returned by: e_GraphWindowAddGraph, e_GraphWindowAppendGraph, e_GraphWindowDisplay.
Returned by: e_GraphWindowDisplay.
Returned by: many.
C Subroutine Detail |
int e_Initialize()
The environment variable ELVISHOST must be set to specify the computer running the ElVis display program.
int e_Register(char *source, char *user, char *host, char *identifier)
source
- - The name of the application.user
- - The user running the application.host
- - The hostname of the computer running the application.identifier
- - An aspect of the run for identifying it to potential display clients.
int e_End()
int e_CloseWindows(int port)
port
- - The port number of the display client after it connects to the server.
int e_GraphWindowCreate(char *windowName, int rows, int columns)
windowName
- - The name of the GraphWindow.rows
- - The number of rows in the GraphWindow.columns
- - The number of columns in the GraphWindow.
int e_GraphWindowDisplay(char *windowName, int port)
windowName
- - The name of the GraphWindow.port
- - The port number of the display client after it connects to the server.
int e_GraphWindowPrint(char *windowName, int row, int column, char *fileName, int port)
The graph is scaled to fit an 8.5" x 11" sheet of paper. If the graph's width is greater than its height then the graph is printed in landscape format. Otherwise the graph is printed in portrait layout.
windowName
- - The name of the GraphWindow.row
- - The row containing the graph to be printed. The top row is row 0.column
- - The column containing the graph to be printed. The leftmost column is column 0.port
- - The port number of the display client after it connects to the server.
int e_GraphWindowAddGraph(char *windowName, char *graphName, int row, int column)
windowName
- - The name of the GraphWindow.graphName
- - The name of the graph.row
- - The graph is inserted in this row.column
- - The graph is inserted in this column.
int e_GraphWindowAddSurface(char *windowName, char *surfaceName, int row, int column)
windowName
- - The name of the GraphWindow.surfaceName
- - The name of the surface.row
- - The graph is inserted in this row.column
- - The graph is inserted in this column.
int e_GraphWindowAppendGraph(char *windowName, char *graphName, int growth)
windowName
- - The name of the GraphWindow.graphName
- - The name of the graph.growth
- - If all cells contain a graph then: if E_TRUE then add a new row to the GraphWindow for this graph; if E_FALSE then delete the first graph, shift all graphs back by 1 cell, and insert this graph in the last cell.
int e_GraphWindowFree(char *windowName)
windowName
- - The name of the GraphWindow.
int e_GraphCreate(char *graphName, int type)
graphName
- - The name of the graph.type
- - The type of datasets that will be added to the graph: E_NO_INDEX, E_TIME_INDEX, or E_VALUE_INDEX.
int e_GraphSetTitle(char *graphName, char *title)
graphName
- - The name of the graph.title
- - The title of the graph.
int e_GraphSetXLabel(char *graphName, char *label)
graphName
- - The name of the graph.label
- - The text for the axis label.
int e_GraphSetYLabel(char *graphName, char *label)
graphName
- - The name of the graph.label
- - The text for the axis label.
int e_GraphSetXAxis(char *graphName, int loglin)
graphName
- - The name of the graph.loglin
- - E_LINEAR (default) or E_LOGARITHMIC.
int e_GraphSetYAxis(char *graphName, int loglin)
graphName
- - The name of the graph.loglin
- - E_LINEAR (default) or E_LOGARITHMIC.
int e_GraphSetIndexLabel(char *graphName, char *label)
graphName
- - The name of the graph.label
- - The text for the index label.
int e_GraphAddLabel(char *graphName, char *label, float[] location, char *font, char *style, float size, float[] color)
graphName
- - The name of the graph.label
- - The text of the label.location
- - A 2 element array containing the x and y coordinates of the lower left corner of the label.font
- - Specify the name of the font as a character string: Serif, SansSerif, Monospaced, Symbol, Dialog, or DialogInput.style
- - Specify the style of the font as a character string: Plain, Bold, Italic, or Bold_Italic.size
- - The size of the font is specified in 0. - 1. coordinates.color
- - The color for drawing the label. A 3 element array containing the red, green, and blue intensity values. The intensity value range is 0. - 1 where 0 is no color and 1 is the brightest..
int e_GraphSetPlotArea(char *graphName, float[] location, float width, float height)
graphName
- - The name of the graph.location
- - The coordinate location of the lower left corner of the plot area.width
- - The width, 0. - 1., of the plot area.height
- - The height, 0. - 1., of the plot area.
int e_GraphSetLegend(char *graphName, float[] location)
graphName
- - The name of the graph.location
- - The coordinate location of the upper left corner of the legend.
int e_GraphShowLegend(char *graphName, int show)
graphName
- - The name of the graph.show
- - E_TRUE (default if this routine is not called) or E_FALSE.
int e_GraphAddFxDataset(char *graphName, char *datasetName)
graphName
- - The name of the graph.datasetName
- - The name of the dataset.
int e_GraphAddFxDatasetID(char *graphName, int ID)
graphName
- - The name of the graph.ID
- - The name of the dataset.
int e_FxCreate(char *datasetName, int points, double x, double fx)
datasetName
- - The name of the dataset.points
- - The number of points in the dataset.x
- - The x values of the points.fx
- - The f(x) values of the points.
int e_ShowMarkers(char *datasetName, int showInterval)
datasetName
- - The name of the dataset.showInterval
- - 0 = do not draw markers (default). 1 = draw marker at every point. Values greater than 1 = number of points to skip before drawing next marker.
int e_ShowLines(char *datasetName, int show)
datasetName
- - The name of the dataset.show
- - E_TRUE: draw a line between data point (default). E_FALSE: do not draw a line between data points.
int e_FxtDatasetCreate(char *datasetName, int points, double x, double fx, double time)
datasetName
- - The name of the dataset.points
- - The number of points in the dataset.x
- - The x values of the points.fx
- - The f(x) values of the points.time
- - The index of the dataset.
int e_FxtDatasetDisplay(char *windowName, char *graphName, char *datasetName)
windowName
- - The name of the GraphWindow containing the graph.graphName
- - The name of the graph containing the Fxt datasets.datasetName
- - The name of the new dataset to display.
int e_SurfaceCreate(char *surfaceName, char *graphName)
surfaceName
- - The name of the surface being created.graphName
- - The name of the graph containing an indexed dataset or time indexed dataset.
int e_SurfaceSetTitle(char *surfaceName, char *title)
surfaceName
- - The name of the surface.title
- - The title of the graph.