dataGraph
Class DataGraph

java.lang.Object
  extended byjava.awt.Component
      extended byjava.awt.Container
          extended byjava.awt.Panel
              extended byjava.applet.Applet
                  extended byedu.davidson.tools.SApplet
                      extended bydataGraph.DataGraph
All Implemented Interfaces:
javax.accessibility.Accessible, java.awt.image.ImageObserver, java.awt.MenuContainer, java.io.Serializable

public class DataGraph
extends SApplet

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

 

See Also:
Serialized Form

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 edu.davidson.tools.SApplet
addDataListener, addDataSource, checkAppletNames, cleanupDataConnections, clearAllData, clearData, deleteDataConnection, deleteDataConnections, formatValue, forward, getAppletName, getClockID, getClockTime, getDataFromDS, getDataListener, getDataSource, getDataSource, getDebugLevel, getID, getSourceData, getSourceVariables, isClockRunning, isValidFunction, pause, removeDataListener, removeDataSource, reset, reverse, sendDataToListener, setClockContinous, setClockCycle, setClockOneShot, setClockTime, setConnectionBlock, setConnectionListener, setConnectionSmoothing, setConnectionSource, setConnectionStride, setConnectionWindowX, setConnectionWindowY, setDebugLevel, setDt, setExternalClock, setFPS, setIndependentClock, setTimeContinuous, setTimeCycle, setTimeOneShot, startClock, stepClock, stepTime, stepTimeBack, stepTimeForward, stop, stopClock, updateDataConnection, updateDataConnections
 
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

getAppletInfo

public java.lang.String getAppletInfo()
Gets the applet information.

Returns:
the information

getParameterInfo

public java.lang.String[][] getParameterInfo()
Gets the parameter inforamtion.

Returns:
the information

getGraphID

public int getGraphID()
Get the series ID for the applet. This ID is used to make a connection to a SDataSource.


getSeriesID

public int getSeriesID(int sid)

getRegressionID

public int getRegressionID(int sid,
                           int start,
                           int end)
The id to the linear regression data source. The source variables are m,b,dm, and db.

Parameters:
sid - the series id.
start - the first point to use in the regression
end - the last point to use in the regression
Returns:
int the object identifier for the data source

addDatum

public void addDatum(int sid,
                     double x,
                     double y)
Adds a data point to the series.

Parameters:
x - value
y - value

addCursor

public int addCursor(double x,
                     double y)
Adds a dragable cursor to the graph. The cursor is a data source.

Parameters:
x - The initial x coordinate.
y - The initial y coordinate.
Returns:
int The ID.

addConnectorLine

public int addConnectorLine(int id1,
                            int id2)
Adds a connector line between two objects

Returns:
the object id

addObject

public int addObject(java.lang.String name,
                     java.lang.String parList)
Creates an object and adds it to this Physlet. The first argument is the name of the object to be added and the second is a comma-delimited list of parameters. For example, a circle can be added a follows:

addObject ("circle", "x = 0, y = -1.0, r = 10");

See the supplemental documentation for a list of object names and parameters.

Parameters:
name - the type of object to be created.
parList - a list of parameters to be set
Returns:
id that identifies the object.

set

public boolean set(int id,
                   java.lang.String name,
                   java.lang.String parList)
Changes the properies of an object. The first argument is the object identifier. The second argument is the name of the property and the third is a comma-delimited list of parameters. For example, the scale can be added a follows:

set(id, "sale", "xmin=0, xmax=2, autoscalx=false");

Parameters:
id - the identifier of the object
name - the type of property to be created.
parList - a list of parameters
Returns:
true if successful

setAnimationSlave

public boolean setAnimationSlave(int masterID,
                                 int slaveID)
Forces an object to follow another object on the screen.

Parameters:
masterID - The id of the master object.
slaveID - The id of the slave object.
Returns:
true if successful.

addFunction

public int addFunction(java.lang.String indVar,
                       java.lang.String str)
Deprecated. Replaced by the addObject(String String) method.

Adds an analytic function to the plot.

Parameters:
indVar - the independent variable;
str - the function string, f(v);
Returns:
int the object ID

addCFunction

public int addCFunction(java.lang.String indVar,
                        java.lang.String strRe,
                        java.lang.String strIm)
Deprecated. Replaced by the addObject(String String) method.

Adds a complex function to the plot.

Parameters:
indVar - the independent variable;
strRe - the real function string, f(v);
strIm - the imaginary function string, f(v);
Returns:
int the object ID

deleteFunction

public void deleteFunction(int id)
Deletes a function from the plot.

Parameters:
id - The id of the function;

deleteObject

public void deleteObject(int id)
Deletes an object from this Physlet.

Parameters:
id - the object identifier
Returns:
true if successful

deleteAllFunctions

public void deleteAllFunctions()
Deletes all functions from the plot.


createSeries

public int createSeries(int sid)
Creates a series and return the series ID for use by a data connection. Return an existing ID if the series already exists.

Returns:
series Object ID

deleteSeries

public void deleteSeries(int s)
Deletes a series from the graph.


deleteAllSeries

public void deleteAllSeries()
Deletes every series from the graph.


clearSeries

public void clearSeries(int s)
Clears the data from a series. Series properties such as color and style remain unchanged.


clearAllSeries

public void clearAllSeries()
Clears all data from the graph. Series properties such as color and style remain unchanged.


makeDataConnection

public int makeDataConnection(int sourceID,
                              int listenerID,
                              int seriesID,
                              java.lang.String xStr,
                              java.lang.String yStr)
Makes a new data connection.

Overrides:
makeDataConnection in class SApplet
Parameters:
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 -
Returns:
SDataConnection The hasCode id of the newly created data connection.

loadDataFile

public void loadDataFile(int sid,
                         java.lang.String fileName)
Reads a data file. Data is stored as comma delimited x,y coordinate values.

Parameters:
sid - The series id.
fileName - The file name

plotRegression

public int plotRegression(int sid,
                          int start,
                          int end)
Plots a linear regression for the data in a series. The regression is stored as an analytic function.

Parameters:
sid - the series id.
start - the first point to use in the regression
end - the last point to use in the regression
Returns:
int the object identifier. Use the object id to reference the regression as a function.

setAutoRefresh

public void setAutoRefresh(boolean auto)
Sets the autoRefresh property. AutoRefresh will repaint the graph whenever data changes. This slows down the computer and may cause flicker.

Overrides:
setAutoRefresh in class SApplet
Parameters:
auto - AutoRefresh the graph?

setAddRepeatedDatum

public void setAddRepeatedDatum(int sid,
                                boolean add)
Sets the addRepeatedDataum property. A new datum will not be added to a series if this is false. Default is true.

Parameters:
add - Added repeated data values to the graph?

setAutoscaleX

public void setAutoscaleX(boolean autoOn)
Sets the autoscaleX property for the graph.

Parameters:
autoOn - Autoscale the x axis?

setAutoscaleY

public void setAutoscaleY(boolean autoOn)
Sets the autoscaleY property for the graph.

Parameters:
autoOn - Autoscale the y axis?

setDrawGrid

public void setDrawGrid(boolean drawOn)
Sets the draw grid property for the graph.

Parameters:
drawOn - Draw the grid?

setDrawZero

public void setDrawZero(boolean drawOn)
Sets the graph to draw lines at x=0 and y=0.

Parameters:
drawOn - Draw the zero lines?

setDefault

public void setDefault()
Sets the default values. Deletes functions. Deletes series. Deletes objects such as circles and rectangles.

Overrides:
setDefault in class SApplet

getH

public double getH(int id)
Gets the height of an object.

Parameters:
id - the object identifier
Returns:
the height

setH

public boolean setH(int id,
                    double h)
Changes the height of an object.

Parameters:
id - the object identifier
h - new height in pixels
Returns:
true if successful

getW

public double getW(int id)
Gets the width of an object.

Parameters:
id - The id of the object.
Returns:
the width

setW

public boolean setW(int id,
                    double w)
Changes the width of an object..

Parameters:
id - the object identifier
w - new width in pixels
Returns:
true if successful

getX

public double getX(int id)
Gets the x world coordinate of the object.

Returns:
the x value

getY

public double getY(int id)
Gets the y world coordinate of the object.

Returns:
the y value

getXPos

public double getXPos(int id)
Bug-fix to get the x of an object on Netscape and Sun.

Parameters:
id - The id of the object.
Returns:
true if successful

getYPos

public double getYPos(int id)
Bug-fix to get the y of an object on Netscape and Sun.

Parameters:
id - The id of the object.
Returns:
true if successful

setXY

public boolean setXY(int id,
                     double x,
                     double y)
Sets the world coordinates of the object.

Returns:
the x value

setX

public boolean setX(int id,
                    double x)
Sets the x world coordinate of the object.

Returns:
the x value

setXPos

public boolean setXPos(int id,
                       double x)

setY

public boolean setY(int id,
                    double y)
Sets the y world coordinate of the object.

Returns:
the y value

setYPos

public boolean setYPos(int id,
                       double y)

setVisibility

public boolean setVisibility(int id,
                             boolean show)
Sets the visibility of the object.

Parameters:
show - object on screen?
Returns:
true if successful

setDisplayOffset

public boolean setDisplayOffset(int id,
                                int xOff,
                                int yOff)
Offsets the object's position on the screen from its default drawing position.

Parameters:
id - The id of the object.
Returns:
True if successful.

setDragable

public boolean setDragable(int id,
                           boolean drag)
Makes the object with the given id dragable.

Parameters:
id - The id of the object.
drag - Dragable?
Returns:
true if successful.

setResizable

public boolean setResizable(int id,
                            boolean resize)
Makes the object with the given id resizable.

Parameters:
id - the id of the object
Returns:
true if successful

setSketchMode

public int setSketchMode(boolean sketch)
Enables sketching with the mouse.

Parameters:
sketch - true will sketch
Returns:
int the id of the mouse data source

setEnableMouse

public void setEnableMouse(boolean mouseOn)
Enables to mouse to show coordinates.

Parameters:
mouseOn - Enable the mouse?

setFunctionRange

public void setFunctionRange(int id,
                             double xmin,
                             double xmax,
                             int n)
Sets the range of an analytic function.

Parameters:
id - The id of the function.
xmin - Minimum value of the range.
xmax - Maximum value of the range.
n - The number of data points.

setFunctionClip

public void setFunctionClip(int id,
                            double min,
                            double max)
Clips the v values on a function.

Parameters:
id - The id of the function.

setYScaleFromFunction

public void setYScaleFromFunction(int id)
Sets the y scale of the graph to the analytic function max-min. The Y scale of a graph only depends on the the data in the data series. This method can be used to set the scale to the max-min of an analytic function.

Parameters:
id - The id of the function.

setFunctionString

public boolean setFunctionString(int id,
                                 java.lang.String str)
Changes the function that is being ploted.

Parameters:
str - The function string, f(x);

swapZOrder

public boolean swapZOrder(int id1,
                          int id2)
Swaps the drawing order on the screen.

Parameters:
id1 - The first id of a screen object.
id2 - The second id of a screen object.
Returns:
True if successful.

getFunctionString

public java.lang.String getFunctionString(int id)
Get the function that is being ploted.

Parameters:
id - The id of the function.
Returns:
str The function string, f(x);

setFunctionVariable

public boolean setFunctionVariable(int id,
                                   java.lang.String str)
Changes the function's independent variable.

Parameters:
id - The id of the function.
str - The new independent variable.

setGutters

public void setGutters(int g1,
                       int g2,
                       int g3,
                       int g4)
Sets the gutters, i.e., margins, around the graph. Should only be used if the axes are set to be visible.

Parameters:
g1 - The gutter on the left of the graph.

setFormat

public void setFormat(java.lang.String str)
Changes the display format for mouse actions. Use UNIX fprint syntax.

Parameters:
str - The format for cooridinate display.

cloneGraph

public void cloneGraph()
Makes a copy of the graph in a separate window.


setFormat

public boolean setFormat(int id,
                         java.lang.String fstr)
Changes the object's format for the display of numeric data. An id of zero will change the display format for mouse actions. Use this method to control the number of significant digits in calculations with text objects. Use Unix printf conventions. For example fstr="%6.3f"

Parameters:
id - The id of the object.
fstr - the format string.
Returns:
True if successful.

setLabelX

public void setLabelX(java.lang.String s)
Sets the x axis label.


setLabelY

public void setLabelY(java.lang.String s)
Sets the y axis label.


setMarkerSize

public void setMarkerSize(int id,
                          double size)
Sets the marker size.

Parameters:
id - Series id.
size - Marker size.

setMinMaxX

public void setMinMaxX(double min,
                       double max)
Sets the x axis minimum and maximum values. No effect if autoscale is true.

Parameters:
min - Minumum value.
max - Maximum value.

setMinMaxY

public void setMinMaxY(double min,
                       double max)
Sets the y axis minimum and maximum values. No effect if autoscale is true.

Parameters:
min - Minumum value.
max - Maximum value.

setMinXRange

public 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.

Parameters:
enable - true to restrict the range, false otherwise
min - minimum value.
max - maximum value.

setMinYRange

public 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.

Parameters:
enable - true to restrict the range, false otherwise
min - minimum value.
max - maximum value.

setSeriesLegend

public void setSeriesLegend(int id,
                            int xpix,
                            int ypix,
                            java.lang.String legend)
Sets the series legend.

Parameters:
id - The series id.
xpix - The x postion in pixels.
ypix - The y postion in pixels.
legend - The legend.

setSeriesLegendRGB

public void setSeriesLegendRGB(int id,
                               int r,
                               int g,
                               int b)
Sets the series legend color.

Parameters:
id - The series id.
r - red.
g - green.
b - blue.

setSeriesStyle

public void setSeriesStyle(int id,
                           boolean conPts,
                           int m)
Sets the series style.

Parameters:
id - The series id.
conPts - Connect the points?
m - Marker style. (m=1 is cross; m=2 is square, m=3 is circle)

setSeriesRGB

public void setSeriesRGB(int id,
                         int r,
                         int g,
                         int b)
Set the series line and marker color.

Parameters:
id - The series id.
r - red.
g - green.
b - blue.

setRGB

public void setRGB(int id,
                   int r,
                   int g,
                   int b)
Sets the color of the object.

Parameters:
id - The series id.
r - red.
g - green.
b - blue.

setAutoReplaceData

public void setAutoReplaceData(int id,
                               boolean auto)
Disables the clearSeries function so that new data will replace a dataset when the addData method is called. Eliminates screen flash since clearSeries(id) does not have to be called.

Parameters:
id - The series id.
auto - AutoReplace

setLastPointMarker

public void setLastPointMarker(int id,
                               boolean lpm)
Sets the series so that the last point in the dataset has a distinctive marker.

Parameters:
id - The series id.
lpm - Enable the marker.

setTitle

public void setTitle(java.lang.String str)
Sets the graph title.

Parameters:
str - Title string.

setTimeDisplay

public void setTimeDisplay(boolean show)
Enables the time display in the applet window.

Parameters:
show - boolean Show the time?

setShowAxes

public void setShowAxes(boolean show)
Shows or hides the the X and Y axes on the graph. A program may need to set the gutters to zero eliminate extra white space.

Parameters:
show - Show the axis?

setSquare

public void setSquare(boolean isSquare)
Sets the aspect ratio=1 so that both axes have the same pixels per unit.


setSorted

public void setSorted(int sid,
                      boolean sorted)
Sorts the series data according to the x value.

Parameters:
sid - the series number
sorted - true if data should be sorted

setStripChart

public void setStripChart(int sid,
                          int numPts,
                          boolean stripChart)
Sets strip chart mode. A strip chart will drop data points to keep the total number of displayed points constant.

Parameters:
sid - the series number
numPts - the number of points in the strip chart
stripChart - true for stip chart mode

xFromPix

public double xFromPix(int x)
Gets the value on the x axis from the pixel value.

Parameters:
x - The pixel inside the canvas.
Returns:
The corresponding value along the x axis.

yFromPix

public double yFromPix(int y)
Gets the value on the y axis from the pixel value.

Parameters:
y - The pixel inside the canvas.
Returns:
The corresponding value along the y axis.

pixFromX

public int pixFromX(double x)
Gets the pixel value corresponding to an x value.

Parameters:
x - The value along the x axis.
Returns:
The pixel value inside the canvas.

pixFromY

public int pixFromY(double y)
Gets the pixel value corresponding to an y value.

Returns:
The pixel value inside the canvas.


Visit the Davidson College Physlet Site for additional information.