| java.lang.Object edu.hws.jcm.draw.Drawable edu.hws.jcm.draw.ScatterPlot
ScatterPlot | public class ScatterPlot extends Drawable implements Computable(Code) | | 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.
|
Method Summary | |
public void | compute() Recompute the data for the scatter plot. | public void | draw(Graphics g, boolean coordsChanged) Draw the data points and regression line. | public boolean | getAutoChangeLimits() The return value indicates whether the limits on the CoordinateRect are
automatically adjusted when the data is recomputed. | public Color | getDataColor() Get the color that is used to draw the points in the data. | public Color | getLineColor() Get the color that is used to draw the regression line. | public boolean | getMissingValueIsError() The return value indicates whether missing data is considered to be
an error. | public boolean | getShowRegressionLine() The return value tells whether a regression line is drawn. | public DataTableInput | getTable() Get the DataTableInput from which the plotted data is obtained. | public Value | getValueObject(int valueCode) Get a Value that represents a statistic about the data that is shown
in the scatter plot. | public 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. | public void | setColumns(int c1, int c2) Specify that the data to be plotted should be taken from the specified
columns in the table. | public void | setDataColor(Color color) Set the color that is used to draw the points in the data. | public 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. | public void | setLineColor(Color color) Set the color that is used to draw the regression line. | public 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. | public void | setShowRegressionLine(boolean line) If the parameter is true, then a regression line for the data is drawn. | public void | setTable(DataTableInput table) Specify the table from which the plotted data is to be taken. |
INTERCEPTSLOPEDATACTMISSINGCTSTANDARDERRORCORRELATION | final public static int INTERCEPTSLOPEDATACTMISSINGCTSTANDARDERRORCORRELATION(Code) | | A constant that can be used in the getValueObject() method to
indicate which statistic the object should represent.
|
ScatterPlot | public ScatterPlot()(Code) | | Default constructor. A data table, at least, must be specified before anything can be drawn.
The first two columns of the table will be plotted (once a table is specified).
|
ScatterPlot | public ScatterPlot(DataTableInput table)(Code) | | Create a scatter plot to plot data from the specified table. Initially, it is configured
to plot data from the first two columns in the table.
|
ScatterPlot | public ScatterPlot(DataTableInput table, int column1, int column2)(Code) | | Create a scatter plot to plot data from two specified columns in a table.
Columns are numbered starting from zero.
|
ScatterPlot | public ScatterPlot(DataTableInput table, Expression exp1, Expression exp2)(Code) | | Create scatter plot to plot specified expressions using data from a table.
The expressions should include references to the column names from the table
and can also refer to the special variable "rowNumber".
|
compute | public void compute()(Code) | | Recompute the data for the scatter plot. This is generally
not called directly.
|
draw | public void draw(Graphics g, boolean coordsChanged)(Code) | | Draw the data points and regression line. Not meant to be called directly.
|
getAutoChangeLimits | public boolean getAutoChangeLimits()(Code) | | The return value indicates whether the limits on the CoordinateRect are
automatically adjusted when the data is recomputed.
|
getDataColor | public Color getDataColor()(Code) | | Get the color that is used to draw the points in the data.
|
getLineColor | public Color getLineColor()(Code) | | Get the color that is used to draw the regression line.
|
getMissingValueIsError | public boolean getMissingValueIsError()(Code) | | The return value indicates whether missing data is considered to be
an error.
|
getShowRegressionLine | public boolean getShowRegressionLine()(Code) | | The return value tells whether a regression line is drawn.
|
getTable | public DataTableInput getTable()(Code) | | Get the DataTableInput from which the plotted data is obtained.
|
getValueObject | public Value getValueObject(int valueCode)(Code) | | Get a Value that represents a statistic about the data that is shown
in the scatter plot. The parameter specifies which statistic is represented.
It can be one of the constants defined in this class: SLOPE (of regression line),
INTERCEPT (y-intercept of regression line), DATACT (number of data points),
MISSINGCT (number of missing data; alwasy zero if the missingValueIsError property
is true), STANDARDERROR (standard error of regression line), and CORRELATION
(correlation coefficient between first and second coordintes of data points).
|
setAutoChangeLimits | public void setAutoChangeLimits(boolean set)(Code) | | If the parameter is true, then the limits on the CoordinateRect that contains
this ScatterPlot are automatically adjusted whenever the data is recomputed.
The default value is true.
|
setColumns | public void setColumns(int c1, int c2)(Code) | | Specify that the data to be plotted should be taken from the specified
columns in the table. Note that columns are numbered starting from zero.
The parameters must be within the range of column numbers in the table.
|
setDataColor | public void setDataColor(Color color)(Code) | | Set the color that is used to draw the points in the data.
The default value is red.
|
setExpressions | public void setExpressions(Expression exp1, Expression exp2)(Code) | | Specify the data for the the plot is to be obtained by evaluating
the two expressions that are given as parameters. Both expressions
should be non-null. The expressions can only be created by a Parser
to which the variables from the table have been added by calling
the method DataTableInput.addVariablesToParser(). The expressions
are evaluated once for each row in the table to obtain the data to be ploted. They can include
references to the column names from the table and to the special
variable "rowNumber", which represents the number of the current row.
|
setLineColor | public void setLineColor(Color color)(Code) | | Set the color that is used to draw the regression line.
The default value is black.
|
setMissingValueIsError | public void setMissingValueIsError(boolean isError)(Code) | | 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. If the value is
false, missing data are ignored, and the value of MISSINGCT gives the
number of points for which the data was missing. Note that invalid
data (a cell that contains text that does not represent a number) is
always considered to be an error. Also note that completely empty
rows at the bottom of a DataTableInput are always ignored and are
never considered to be an error.
The default value of missingValueIsError is true, so that missing data
is considered to be an error unless you turn off this option.
|
setShowRegressionLine | public void setShowRegressionLine(boolean line)(Code) | | If the parameter is true, then a regression line for the data is drawn.
The default value is true.
|
setTable | public void setTable(DataTableInput table)(Code) | | Specify the table from which the plotted data is to be taken. The data from the
first two columns of the table will be plotted, unless this is changed by
calling setColumns() or setExpressions().
|
|
|