|
ElVis Java Interface | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object sv.graph.GraphWindow
The GraphWindow is the object interface to ElVis. Application programs that can use Java objects and methods can send data to ElVis using the GraphWindow object.
The GraphWindow class defines the methods and data for defining a grid of graphs. Each cell of the grid contains one graph. A graph contains one or more datasets.
The cells can be interactively resized using the mouse. Dragging the right edge of a graph changes the width of all the graphs in a column. Dragging the bottom edge of a graph changes the height of all the graphs in the row. Dragging the lower right corner of a graph with mouse button 1 simultaneously changes column width and row height. Dragging the lower right corner with mouse button 3 resizes the graph while maintaining its aspect ratio.
A GraphWindow contains other Java classes which encapsulate the elements of a graph. A GraphWindow contains one or more graphs defined by the Fx, Fxi, Fxt, Surface, or Contour class. Each graph contains one or more datasets defined by the Data1D class. An Fx graph has an X axis and a Y axis. A graph has built in labels for the title, X Axis, Y Axis, and index. Additional labels can be drawn using the GLabel class or the addLabel method.
A program that sends GraphWindows to ElVis is a data source. The program creates a DataSource object to identify itself and send data to ElVis where it is displayed. An example program for drawing a graph:
import sv.graph.*; import java.awt.*; public class ESample { static DataSource dataSource; public static void main(String[] args) { dataSource = new DataSource(); boolean status = dataSource.register(); if (!status) { System.out.println("Could not register with ElVis"); System.exit(1); } drawGraph(); dataSource.exit(); } public static void drawGraph() { GraphWindow gw = new GraphWindow("Label Example"); Fx graph = new Fx("Graph Comparison"); int nPoints = 20; float [] x = new float [nPoints]; float [] x2 = new float [nPoints]; float [] fx = new float [nPoints]; float [] gx = new float [nPoints]; for (int i=0; i<nPoints; i++) { x[i] = (float) i; x2[i] = (float) i/2; fx[i] = (float) i; gx[i] = (float) 3*i; } Data1D dataset = new Data1D("linear", nPoints, x, fx); Data1D dataset2 = new Data1D("scaled", nPoints, x2, gx); graph.addDataset(dataset); graph.addDataset(dataset2); graph.setXLabel("Distance"); graph.setYLabel("Speed"); Color blue = new Color(0.f, 0.f, 1.f); graph.addLabel("Serif", .15f, .8f, "Serif", "Plain", .06f, blue, 0.f); graph.addLabel("Bold", .46f, .8f, "Serif", "Bold", .06f, blue, 0.f); graph.addLabel("Italic", .60f, .8f, "Serif", "Italic", .06f, blue, 0.f); graph.addLabel("Symbol", .15f, .5f, "Symbol", "Plain", .06f, blue, 0.f); graph.addLabel("??", .46f, .5f, "Symbol", "Bold", .06f, blue, 0.f); graph.addLabel("?", .60f, .5f, "Symbol", "Italic", .06f, blue, 0.f); gw.addGraph(graph, 0, 0); dataSource.write(gw); } }
Field Summary | |
int |
currentFrame
|
static int |
DATATABLE
data table |
static int |
FX
f(x) graph, datasets are not indexed. |
static int |
FXI
f(x,i) graph, datasets with arbitrary index. |
static int |
FXT
f(x,t) graph, datasets indexed by time. |
static int |
FXT_ADD_POINTS
f(x,t) graph, datasets indexed by time. |
static int |
FXY
f(x,y) graph |
Interaction |
interaction
|
boolean |
isInteraction
|
static int |
MIXED
The GraphWindow contains more than 1 type of graph. |
java.lang.String |
name
|
int |
originalClient
|
int |
shot
|
static int |
SURFACE
The graph is a surface plot |
WhiteBoard |
whiteboard
|
Constructor Summary | |
GraphWindow(java.lang.String gwName)
|
Method Summary | |
void |
addFxt(GraphWindow graphWindow)
Add an Fxt dataset to an existing graph that is already displayed. |
int |
addGraph(DataTable table,
int row,
int column)
Add a table to a specific cell in the GraphWindow. |
int |
addGraph(Fx graph)
Add a graph to the first empty cell in the GraphWindow. |
int |
addGraph(Fx graph,
int row,
int column)
Add a graph to a specific cell in the GraphWindow. |
void |
addPoints(GraphWindow gw)
Add points to an existing dataset that is already displayed. |
int |
appendGraph(Fx graph,
boolean growth)
Append an Fx graph to the GraphWindow. |
GraphWindow |
definition()
|
int |
display(java.io.DataOutputStream out,
int handle)
|
void |
fxtAddPoints(GraphWindow graphWindow)
Add points to existing time steps already displayed |
int |
getColumns()
Return the number of columns of graphs in the GraphWindow. |
java.lang.String |
getName()
Get the name of the GraphWindow. |
int |
getRows()
Return the number of rows of graphs in the GraphWindow. |
int |
getType()
|
int |
printGraph(java.lang.String server,
int port,
int row,
int column,
java.lang.String fileName)
Print a graph. |
int |
read(java.io.DataInputStream in)
|
GraphWindow |
readSerial(java.io.DataInputStream in)
|
void |
setLayout(int rows,
int columns)
Set the number of rows and columns for the grid of graphs. |
void |
setName(java.lang.String windowName)
Set the name of the GraphWindow. |
void |
setType(int type)
Specify the type of graphs that will be in the GraphWindow. |
int |
write(java.io.DataOutputStream out)
Write the GraphWindow to a socket stream |
int |
writeNetCDF(java.lang.String filename)
Write the GraphWindow to a NetCDF file |
int |
writeSequential(java.io.DataOutputStream out)
Write the GraphWindow to a stream |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public java.lang.String name
public int originalClient
public int shot
public boolean isInteraction
public Interaction interaction
public WhiteBoard whiteboard
public int currentFrame
public static final int FX
public static final int FXI
public static final int FXT
public static final int MIXED
public static final int SURFACE
public static final int FXY
public static final int DATATABLE
public static final int FXT_ADD_POINTS
Constructor Detail |
public GraphWindow(java.lang.String gwName)
Method Detail |
public int display(java.io.DataOutputStream out, int handle)
public int write(java.io.DataOutputStream out)
out
- - The stream to another socket
public int writeSequential(java.io.DataOutputStream out)
out
- - The output stream
public int writeNetCDF(java.lang.String filename)
filename
- - The name of the file to create.
public int printGraph(java.lang.String server, int port, int row, int column, java.lang.String fileName)
server
- - The name of the computer running the ElVis display program.port
- - The number of the port on the server computer that ElVis is reading.row
- - The row in the GraphWindow containg the graph to be printed. The top row is row 0.column
- - The column in the GraphWindow containg the graph to be printed. The left most column is column 0.fileName
- - The name of the PostScript file to create.
public void setType(int type)
type
- - The type of graph(s) that will be in the GraphWindow. The types are: GraphWindow.FX (default), GraphWindow.FXI, GraphWindow.FXT, GraphWindow.MIXED.public int getType()
public void setName(java.lang.String windowName)
windowName
- - The name of the GraphWindow.public java.lang.String getName()
public void setLayout(int rows, int columns)
rows
- - The number of rows.columns
- - The number of columns.public int getRows()
public int getColumns()
public int appendGraph(Fx graph, boolean growth)
graph
- - The graph to add to the GraphWindow.growth
- - If true and all cells contain a graph then add a row to the GraphWindow. If false and all cells contain a graph then delete the graph from the first cell, shift all graphsback by 1 cell, insert this graph in the last cell.public int addGraph(Fx graph, int row, int column)
graph
- - The graph to insert. The graph can be Fx, Fxi, Fxt, or a Surface.row
- - The row in the GraphWindow where the graph will be inserted. The top row is row 0.column
- - The column in the GraphWindow where the graph will be inserted. The left most column is column 0.public int addGraph(Fx graph)
graph
- - The graph to insert. The graph can be Fx, Fxi, Fxt, or a Surface.public int addGraph(DataTable table, int row, int column)
table
- - The table to insert.row
- - The row in the GraphWindow where the table will be inserted. The top row is row 0.column
- - The column in the GraphWindow where the table will be inserted. The left most column is column 0.public void addFxt(GraphWindow graphWindow)
graphWindow
- - This GraphWindow should consist of an Fxt graph that contains the dataset to be added. The name of this Fxt must match the name of the graph already displayed.public void fxtAddPoints(GraphWindow graphWindow)
graphWindow
- - This GraphWindow should consist of an Fxt graph that contains the points to be added. Add points to each of the timesteps in the provided graph.public void addPoints(GraphWindow gw)
public int read(java.io.DataInputStream in)
public GraphWindow readSerial(java.io.DataInputStream in)
public GraphWindow definition()
|
ElVis Java Interface | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |