|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.hws.jcm.draw.Drawable | +--edu.hws.jcm.draw.ScatterPlot
A ScatterPlot graphs data taken from a DataTableInput. The data in the form of a small plus sign at each (x,y) in the data. The x and y values can be taken directly from two specified columns in the table. They can also be computed by expressions that can use column names from the table as well as the special variable rowNumber. For example, if column names are X and Y, then it could plot sqrt(X) versus rowNumber*(X+Y).
Optionally, a ScatterPlot will also draw a regression line for the data. Certain statistical values about the data points are available as Value objects by calling the getValueObject() method.
Field Summary | |
static int |
CORRELATION
A constant that can be used in the getValueObject() method to indicate which statistic the object should represent. |
static int |
DATACT
A constant that can be used in the getValueObject() method to indicate which statistic the object should represent. |
static int |
INTERCEPT
A constant that can be used in the getValueObject() method to indicate which statistic the object should represent. |
static int |
MISSINGCT
A constant that can be used in the getValueObject() method to indicate which statistic the object should represent. |
static int |
SLOPE
A constant that can be used in the getValueObject() method to indicate which statistic the object should represent. |
static int |
STANDARDERROR
A constant that can be used in the getValueObject() method to indicate which statistic the object should represent. |
Fields inherited from class edu.hws.jcm.draw.Drawable |
canvas, coords |
Constructor Summary | |
ScatterPlot()
Default constructor. |
|
ScatterPlot(DataTableInput table)
Create a scatter plot to plot data from the specified table. |
|
ScatterPlot(DataTableInput table,
Expression exp1,
Expression exp2)
Create scatter plot to plot specified expressions using data from a table. |
|
ScatterPlot(DataTableInput table,
int column1,
int column2)
Create a scatter plot to plot data from two specified columns in a table. |
Method Summary | |
void |
compute()
Recompute the data for the scatter plot. |
void |
draw(java.awt.Graphics g,
boolean coordsChanged)
Draw the data points and regression line. |
boolean |
getAutoChangeLimits()
The return value indicates whether the limits on the CoordinateRect are automatically adjusted when the data is recomputed. |
java.awt.Color |
getDataColor()
Get the color that is used to draw the points in the data. |
java.awt.Color |
getLineColor()
Get the color that is used to draw the regression line. |
boolean |
getMissingValueIsError()
The return value indicates whether missing data is considered to be an error. |
boolean |
getShowRegressionLine()
The return value tells whether a regression line is drawn. |
DataTableInput |
getTable()
Get the DataTableInput from which the plotted data is obtained. |
Value |
getValueObject(int valueCode)
Get a Value that represents a statistic about the data that is shown in the scatter plot. |
void |
setAutoChangeLimits(boolean set)
If the parameter is true, then the limits on the CoordinateRect that contains this ScatterPlot are automatically adjusted whenever the data is recomputed. |
void |
setColumns(int c1,
int c2)
Specify that the data to be plotted should be taken from the specified columns in the table. |
void |
setDataColor(java.awt.Color color)
Set the color that is used to draw the points in the data. |
void |
setExpressions(Expression exp1,
Expression exp2)
Specify the data for the the plot is to be obtained by evaluating the two expressions that are given as parameters. |
void |
setLineColor(java.awt.Color color)
Set the color that is used to draw the regression line. |
void |
setMissingValueIsError(boolean isError)
If the parameter is true, then a missing data value (an empty cell or an undefined value for one of the expressions) is considered to be an error, and a JCMError is thrown when it is encountered. |
void |
setShowRegressionLine(boolean line)
If the parameter is true, then a regression line for the data is drawn. |
void |
setTable(DataTableInput table)
Specify the table from which the plotted data is to be taken. |
Methods inherited from class edu.hws.jcm.draw.Drawable |
getVisible, needsRedraw, setOwnerData, setVisible |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int INTERCEPT
public static final int SLOPE
public static final int DATACT
public static final int MISSINGCT
public static final int STANDARDERROR
public static final int CORRELATION
Constructor Detail |
public ScatterPlot()
public ScatterPlot(DataTableInput table)
public ScatterPlot(DataTableInput table, int column1, int column2)
public ScatterPlot(DataTableInput table, Expression exp1, Expression exp2)
Method Detail |
public void setTable(DataTableInput table)
public DataTableInput getTable()
public void setColumns(int c1, int c2)
public void setExpressions(Expression exp1, Expression exp2)
public void setShowRegressionLine(boolean line)
public boolean getShowRegressionLine()
public void setMissingValueIsError(boolean isError)
public boolean getMissingValueIsError()
public void setAutoChangeLimits(boolean set)
public boolean getAutoChangeLimits()
public java.awt.Color getDataColor()
public void setDataColor(java.awt.Color color)
public java.awt.Color getLineColor()
public void setLineColor(java.awt.Color color)
public Value getValueObject(int valueCode)
public void compute()
compute
in interface Computable
public void draw(java.awt.Graphics g, boolean coordsChanged)
draw
in class Drawable
edu.hws.jcm.draw.Drawable
g
- The graphics context in which the Drawble is to be drawn. (The drawing
can change the color in g, but should not permanently change font, painting mode, etc.
Thus, every drawable is responsible for setting the color it wants to use.)coordsChanged
- Indicates whether the CoordinateRect has changed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |