|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjava.awt.Component
java.awt.Container
java.awt.Panel
java.applet.Applet
edu.davidson.tools.SApplet
dataGraph.DataGraph
This applet plots data sets and functions. Each data set is a "series" of of coordinate pairs, (x,y). A series is identified by a series numeber. Each series a unique color and style. Whenever data is added, the appropriate series number must be specified.
The following embedding parameters are defined:
Parameter | Value | Type | Description |
---|---|---|---|
Function | null | string | An analytic function, f(x). |
XMin | -1.0 | double | Minimum value along x axis. |
XMin | 1.0 | double | Maximum value along x axis. |
YMin | -1.0 | double | Minimum value along y axis. |
YMax | 1.0 | double | Maximum value along y axis. |
AutoScaleX | true | boolean | Autoscale the x axis. |
AutoScaleY | true | boolean | Autoscale the y axis. |
ShowControls | true | boolean | Show the user interface. |
A DataTable can be used as a data listener by obtaining its object identifier and passing this value to a data connection. This value is obtained using
getGraphID().
A data series is a data source. This enables other data listeners to change whenever data is added to a series. This interface, SDataSource, enables inter-applet data passing between Physlets.
Object | Identifier | Variables |
---|---|---|
series | id=getSeriesID(int sid | x,y,u,v Note: u and v are the differences between neighboring data points, Dx, Dy. |
clock | id=getClockID() | t |
Field Summary |
Fields inherited from class edu.davidson.tools.SApplet |
destroyed |
Fields inherited from class java.awt.Component |
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT |
Fields inherited from interface java.awt.image.ImageObserver |
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH |
Method Summary | |
int |
addCFunction(java.lang.String indVar,
java.lang.String strRe,
java.lang.String strIm)
Deprecated. Replaced by the addObject(String String) method. |
int |
addConnectorLine(int id1,
int id2)
Adds a connector line between two objects |
int |
addCursor(double x,
double y)
Adds a dragable cursor to the graph. |
void |
addDatum(int sid,
double x,
double y)
Adds a data point to the series. |
int |
addFunction(java.lang.String indVar,
java.lang.String str)
Deprecated. Replaced by the addObject(String String) method. |
int |
addObject(java.lang.String name,
java.lang.String parList)
Creates an object and adds it to this Physlet. |
void |
clearAllSeries()
Clears all data from the graph. |
void |
clearSeries(int s)
Clears the data from a series. |
void |
cloneGraph()
Makes a copy of the graph in a separate window. |
int |
createSeries(int sid)
Creates a series and return the series ID for use by a data connection. |
void |
deleteAllFunctions()
Deletes all functions from the plot. |
void |
deleteAllSeries()
Deletes every series from the graph. |
void |
deleteFunction(int id)
Deletes a function from the plot. |
void |
deleteObject(int id)
Deletes an object from this Physlet. |
void |
deleteSeries(int s)
Deletes a series from the graph. |
java.lang.String |
getAppletInfo()
Gets the applet information. |
java.lang.String |
getFunctionString(int id)
Get the function that is being ploted. |
int |
getGraphID()
Get the series ID for the applet. |
double |
getH(int id)
Gets the height of an object. |
java.lang.String[][] |
getParameterInfo()
Gets the parameter inforamtion. |
int |
getRegressionID(int sid,
int start,
int end)
The id to the linear regression data source. |
int |
getSeriesID(int sid)
|
double |
getW(int id)
Gets the width of an object. |
double |
getX(int id)
Gets the x world coordinate of the object. |
double |
getXPos(int id)
Bug-fix to get the x of an object on Netscape and Sun. |
double |
getY(int id)
Gets the y world coordinate of the object. |
double |
getYPos(int id)
Bug-fix to get the y of an object on Netscape and Sun. |
void |
loadDataFile(int sid,
java.lang.String fileName)
Reads a data file. |
int |
makeDataConnection(int sourceID,
int listenerID,
int seriesID,
java.lang.String xStr,
java.lang.String yStr)
Makes a new data connection. |
int |
pixFromX(double x)
Gets the pixel value corresponding to an x value. |
int |
pixFromY(double y)
Gets the pixel value corresponding to an y value. |
int |
plotRegression(int sid,
int start,
int end)
Plots a linear regression for the data in a series. |
boolean |
set(int id,
java.lang.String name,
java.lang.String parList)
Changes the properies of an object. |
void |
setAddRepeatedDatum(int sid,
boolean add)
Sets the addRepeatedDataum property. |
boolean |
setAnimationSlave(int masterID,
int slaveID)
Forces an object to follow another object on the screen. |
void |
setAutoRefresh(boolean auto)
Sets the autoRefresh property. |
void |
setAutoReplaceData(int id,
boolean auto)
Disables the clearSeries function so that new data will replace a dataset when the addData method is called. |
void |
setAutoscaleX(boolean autoOn)
Sets the autoscaleX property for the graph. |
void |
setAutoscaleY(boolean autoOn)
Sets the autoscaleY property for the graph. |
void |
setDefault()
Sets the default values. |
boolean |
setDisplayOffset(int id,
int xOff,
int yOff)
Offsets the object's position on the screen from its default drawing position. |
boolean |
setDragable(int id,
boolean drag)
Makes the object with the given id dragable. |
void |
setDrawGrid(boolean drawOn)
Sets the draw grid property for the graph. |
void |
setDrawZero(boolean drawOn)
Sets the graph to draw lines at x=0 and y=0. |
void |
setEnableMouse(boolean mouseOn)
Enables to mouse to show coordinates. |
boolean |
setFormat(int id,
java.lang.String fstr)
Changes the object's format for the display of numeric data. |
void |
setFormat(java.lang.String str)
Changes the display format for mouse actions. |
void |
setFunctionClip(int id,
double min,
double max)
Clips the v values on a function. |
void |
setFunctionRange(int id,
double xmin,
double xmax,
int n)
Sets the range of an analytic function. |
boolean |
setFunctionString(int id,
java.lang.String str)
Changes the function that is being ploted. |
boolean |
setFunctionVariable(int id,
java.lang.String str)
Changes the function's independent variable. |
void |
setGutters(int g1,
int g2,
int g3,
int g4)
Sets the gutters, i.e., margins, around the graph. |
boolean |
setH(int id,
double h)
Changes the height of an object. |
void |
setLabelX(java.lang.String s)
Sets the x axis label. |
void |
setLabelY(java.lang.String s)
Sets the y axis label. |
void |
setLastPointMarker(int id,
boolean lpm)
Sets the series so that the last point in the dataset has a distinctive marker. |
void |
setMarkerSize(int id,
double size)
Sets the marker size. |
void |
setMinMaxX(double min,
double max)
Sets the x axis minimum and maximum values. |
void |
setMinMaxY(double min,
double max)
Sets the y axis minimum and maximum values. |
void |
setMinXRange(boolean enable,
double min,
double max)
Restricts the range on the x axis so that it can be no smaller than the given values. |
void |
setMinYRange(boolean enable,
double min,
double max)
Restricts the range on the y axis so that it can be no smaller than the given values. |
boolean |
setResizable(int id,
boolean resize)
Makes the object with the given id resizable. |
void |
setRGB(int id,
int r,
int g,
int b)
Sets the color of the object. |
void |
setSeriesLegend(int id,
int xpix,
int ypix,
java.lang.String legend)
Sets the series legend. |
void |
setSeriesLegendRGB(int id,
int r,
int g,
int b)
Sets the series legend color. |
void |
setSeriesRGB(int id,
int r,
int g,
int b)
Set the series line and marker color. |
void |
setSeriesStyle(int id,
boolean conPts,
int m)
Sets the series style. |
void |
setShowAxes(boolean show)
Shows or hides the the X and Y axes on the graph. |
int |
setSketchMode(boolean sketch)
Enables sketching with the mouse. |
void |
setSorted(int sid,
boolean sorted)
Sorts the series data according to the x value. |
void |
setSquare(boolean isSquare)
Sets the aspect ratio=1 so that both axes have the same pixels per unit. |
void |
setStripChart(int sid,
int numPts,
boolean stripChart)
Sets strip chart mode. |
void |
setTimeDisplay(boolean show)
Enables the time display in the applet window. |
void |
setTitle(java.lang.String str)
Sets the graph title. |
boolean |
setVisibility(int id,
boolean show)
Sets the visibility of the object. |
boolean |
setW(int id,
double w)
Changes the width of an object.. |
boolean |
setX(int id,
double x)
Sets the x world coordinate of the object. |
boolean |
setXPos(int id,
double x)
|
boolean |
setXY(int id,
double x,
double y)
Sets the world coordinates of the object. |
boolean |
setY(int id,
double y)
Sets the y world coordinate of the object. |
boolean |
setYPos(int id,
double y)
|
void |
setYScaleFromFunction(int id)
Sets the y scale of the graph to the analytic function max-min. |
boolean |
swapZOrder(int id1,
int id2)
Swaps the drawing order on the screen. |
double |
xFromPix(int x)
Gets the value on the x axis from the pixel value. |
double |
yFromPix(int y)
Gets the value on the y axis from the pixel value. |
Methods inherited from class java.applet.Applet |
destroy, getAccessibleContext, getAppletContext, getAudioClip, getAudioClip, getCodeBase, getDocumentBase, getImage, getImage, getLocale, getParameter, init, isActive, newAudioClip, play, play, resize, resize, setStub, showStatus, start |
Methods inherited from class java.awt.Panel |
addNotify |
Methods inherited from class java.awt.Container |
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getInsets, getLayout, getListeners, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paint, paintComponents, preferredSize, print, printComponents, remove, remove, removeAll, removeContainerListener, removeNotify, setFocusCycleRoot, setFocusTraversalKeys, setFocusTraversalPolicy, setFont, setLayout, transferFocusBackward, transferFocusDownCycle, update, validate |
Methods inherited from class java.awt.Component |
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, contains, contains, createImage, createImage, createVolatileImage, createVolatileImage, disable, dispatchEvent, enable, enable, enableInputMethods, getBackground, getBounds, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphics, getGraphicsConfiguration, getHeight, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocation, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isDoubleBuffered, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, printAll, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, requestFocusInWindow, reshape, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFocusable, setFocusTraversalKeysEnabled, setForeground, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, transferFocusUpCycle |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Method Detail |
public java.lang.String getAppletInfo()
public java.lang.String[][] getParameterInfo()
public int getGraphID()
public int getSeriesID(int sid)
public int getRegressionID(int sid, int start, int end)
sid
- the series id.start
- the first point to use in the regressionend
- the last point to use in the regression
public void addDatum(int sid, double x, double y)
x
- valuey
- valuepublic int addCursor(double x, double y)
x
- The initial x coordinate.y
- The initial y coordinate.
public int addConnectorLine(int id1, int id2)
public int addObject(java.lang.String name, java.lang.String parList)
addObject ("circle", "x = 0, y = -1.0, r = 10");
name
- the type of object to be created.parList
- a list of parameters to be set
public boolean set(int id, java.lang.String name, java.lang.String parList)
set(id, "sale", "xmin=0, xmax=2, autoscalx=false");
id
- the identifier of the objectname
- the type of property to be created.parList
- a list of parameters
public boolean setAnimationSlave(int masterID, int slaveID)
masterID
- The id of the master object.slaveID
- The id of the slave object.
public int addFunction(java.lang.String indVar, java.lang.String str)
indVar
- the independent variable;str
- the function string, f(v);
public int addCFunction(java.lang.String indVar, java.lang.String strRe, java.lang.String strIm)
indVar
- the independent variable;strRe
- the real function string, f(v);strIm
- the imaginary function string, f(v);
public void deleteFunction(int id)
id
- The id of the function;public void deleteObject(int id)
id
- the object identifier
public void deleteAllFunctions()
public int createSeries(int sid)
public void deleteSeries(int s)
public void deleteAllSeries()
public void clearSeries(int s)
public void clearAllSeries()
public int makeDataConnection(int sourceID, int listenerID, int seriesID, java.lang.String xStr, java.lang.String yStr)
makeDataConnection
in class SApplet
sourceID
- The id of the data source.listenerID
- The id of the data listener. This is usually an applet.seriesID
- The id of the series in the data listener.xStr
- The function of the data source variables to be plotted on the horizontal axis.yStr
-
public void loadDataFile(int sid, java.lang.String fileName)
sid
- The series id.fileName
- The file namepublic int plotRegression(int sid, int start, int end)
sid
- the series id.start
- the first point to use in the regressionend
- the last point to use in the regression
public void setAutoRefresh(boolean auto)
setAutoRefresh
in class SApplet
auto
- AutoRefresh the graph?public void setAddRepeatedDatum(int sid, boolean add)
add
- Added repeated data values to the graph?public void setAutoscaleX(boolean autoOn)
autoOn
- Autoscale the x axis?public void setAutoscaleY(boolean autoOn)
autoOn
- Autoscale the y axis?public void setDrawGrid(boolean drawOn)
drawOn
- Draw the grid?public void setDrawZero(boolean drawOn)
drawOn
- Draw the zero lines?public void setDefault()
setDefault
in class SApplet
public double getH(int id)
id
- the object identifier
public boolean setH(int id, double h)
id
- the object identifierh
- new height in pixels
public double getW(int id)
id
- The id of the object.
public boolean setW(int id, double w)
id
- the object identifierw
- new width in pixels
public double getX(int id)
public double getY(int id)
public double getXPos(int id)
id
- The id of the object.
public double getYPos(int id)
id
- The id of the object.
public boolean setXY(int id, double x, double y)
public boolean setX(int id, double x)
public boolean setXPos(int id, double x)
public boolean setY(int id, double y)
public boolean setYPos(int id, double y)
public boolean setVisibility(int id, boolean show)
show
- object on screen?
public boolean setDisplayOffset(int id, int xOff, int yOff)
id
- The id of the object.
public boolean setDragable(int id, boolean drag)
id
- The id of the object.drag
- Dragable?
public boolean setResizable(int id, boolean resize)
id
- the id of the object
public int setSketchMode(boolean sketch)
sketch
- true will sketch
public void setEnableMouse(boolean mouseOn)
mouseOn
- Enable the mouse?public void setFunctionRange(int id, double xmin, double xmax, int n)
id
- The id of the function.xmin
- Minimum value of the range.xmax
- Maximum value of the range.n
- The number of data points.public void setFunctionClip(int id, double min, double max)
id
- The id of the function.public void setYScaleFromFunction(int id)
id
- The id of the function.public boolean setFunctionString(int id, java.lang.String str)
str
- The function string, f(x);public boolean swapZOrder(int id1, int id2)
id1
- The first id of a screen object.id2
- The second id of a screen object.
public java.lang.String getFunctionString(int id)
id
- The id of the function.
public boolean setFunctionVariable(int id, java.lang.String str)
id
- The id of the function.str
- The new independent variable.public void setGutters(int g1, int g2, int g3, int g4)
g1
- The gutter on the left of the graph.public void setFormat(java.lang.String str)
str
- The format for cooridinate display.public void cloneGraph()
public boolean setFormat(int id, java.lang.String fstr)
id
- The id of the object.fstr
- the format string.
public void setLabelX(java.lang.String s)
public void setLabelY(java.lang.String s)
public void setMarkerSize(int id, double size)
id
- Series id.size
- Marker size.public void setMinMaxX(double min, double max)
min
- Minumum value.max
- Maximum value.public void setMinMaxY(double min, double max)
min
- Minumum value.max
- Maximum value.public void setMinXRange(boolean enable, double min, double max)
enable
- true to restrict the range, false otherwisemin
- minimum value.max
- maximum value.public void setMinYRange(boolean enable, double min, double max)
enable
- true to restrict the range, false otherwisemin
- minimum value.max
- maximum value.public void setSeriesLegend(int id, int xpix, int ypix, java.lang.String legend)
id
- The series id.xpix
- The x postion in pixels.ypix
- The y postion in pixels.legend
- The legend.public void setSeriesLegendRGB(int id, int r, int g, int b)
id
- The series id.r
- red.g
- green.b
- blue.public void setSeriesStyle(int id, boolean conPts, int m)
id
- The series id.conPts
- Connect the points?m
- Marker style. (m=1 is cross; m=2 is square, m=3 is
circle)public void setSeriesRGB(int id, int r, int g, int b)
id
- The series id.r
- red.g
- green.b
- blue.public void setRGB(int id, int r, int g, int b)
id
- The series id.r
- red.g
- green.b
- blue.public void setAutoReplaceData(int id, boolean auto)
id
- The series id.auto
- AutoReplacepublic void setLastPointMarker(int id, boolean lpm)
id
- The series id.lpm
- Enable the marker.public void setTitle(java.lang.String str)
str
- Title string.public void setTimeDisplay(boolean show)
show
- boolean Show the time?public void setShowAxes(boolean show)
show
- Show the axis?public void setSquare(boolean isSquare)
public void setSorted(int sid, boolean sorted)
sid
- the series numbersorted
- true if data should be sortedpublic void setStripChart(int sid, int numPts, boolean stripChart)
sid
- the series numbernumPts
- the number of points in the strip chartstripChart
- true for stip chart modepublic double xFromPix(int x)
x
- The pixel inside the canvas.
public double yFromPix(int y)
y
- The pixel inside the canvas.
public int pixFromX(double x)
x
- The value along the x axis.
public int pixFromY(double y)
|
|||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |