|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectorg.mbari.siam.moos.utils.chart.graph.DataSet
public class DataSet
This class is designed to hold the data to be plotted. It is to be used in conjunction with the Graph2D class and Axis class for plotting 2D graphs.
| Field Summary | |
|---|---|
boolean |
clipping
Boolean to control clipping of the data window. |
protected double[] |
data
The array containing the actual data |
protected double |
dxmax
The data X maximum. |
protected double |
dxmin
The data X minimum. |
protected double |
dymax
The data Y maximum. |
protected double |
dymin
The data Y minimum. |
Graph2D |
g2d
The Graphics canvas that is driving the whole show. |
protected int |
increment
The amount to increment the data array when the append method is being used. |
protected double |
legend_dx
The X data position of the data legend |
protected double |
legend_dy
The Y data position of the data legend |
protected int |
legend_ix
The X pixel position of the data legend |
protected int |
legend_iy
The Y pixel position of the data legend |
protected int |
legend_length
The length of the example line in the data legend. |
protected TextLine |
legend_text
The legend text |
protected int |
length
The number of data points stored in the data array |
static int |
LINE
A constant value flag used to specify that a straight line segment is to join the data points. |
java.awt.Color |
linecolor
The color of the straight line segments |
int |
linestyle
The linestyle to employ when joining the data points with straight line segments. |
int |
marker
The index of the marker to use at the data points. |
java.awt.Color |
markercolor
The marker color |
double |
markerscale
The scaling factor for the marker. |
static int |
NOLINE
A constant value flag used to specify no straight line segment is to join the data points |
protected int |
stride
The stride of the data. |
Axis |
xaxis
The Axis object the X data is attached to. |
double |
xmax
The current plottable X maximum of the data. |
double |
xmin
The current plottable X minimum of the data. |
protected double |
xrange
The X range of the clipped data |
Axis |
yaxis
The Axis object the Y data is attached to. |
double |
ymax
The current plottable Y maximum of the data. |
double |
ymin
The current plottable Y minimum of the data. |
protected double |
yrange
The Y range of the clipped data |
| Constructor Summary | |
|---|---|
DataSet()
Instantiate an empty data set. |
|
DataSet(double[] d,
int n)
Instantiate a DataSet with the parsed data. |
|
DataSet(double[] d,
int n,
int s)
Instantiate a DataSet with the parsed data. |
|
DataSet(int stride)
Instantiate an empty data set. |
|
| Method Summary | |
|---|---|
void |
append(double[] d,
int n)
Append data to the data set. |
int |
dataPoints()
Return the number of data points in the DataSet |
void |
delete(int start,
int end)
Delete data from the data set (start and end are inclusive). |
void |
deleteData()
Delete all the data from the data set. |
void |
draw_data(java.awt.Graphics g,
java.awt.Rectangle bounds)
Draw the straight line segments and/or the markers at the data points. |
protected void |
draw_legend(java.awt.Graphics g,
java.awt.Rectangle w)
Draw a legend for this data set |
protected void |
draw_lines(java.awt.Graphics g,
java.awt.Rectangle w)
Draw into the data window the straight line segments joining the data points. |
protected void |
draw_markers(java.awt.Graphics g,
java.awt.Rectangle w)
Draw the markers. |
double[] |
getClosestPoint(double x,
double y)
Return the data point that is closest to the parsed (x,y) position |
double[] |
getPoint(int index)
get the data point at the parsed index. |
double |
getXmax()
return the data X maximum. |
double |
getXmin()
return the data X minimum. |
double |
getYmax()
return the data Y maximum. |
double |
getYmin()
return the data Y minimum. |
protected boolean |
inside(double x,
double y)
Return true if the point (x,y) is inside the allowed data range. |
void |
legend(double x,
double y,
java.lang.String text)
Define a data legend in the graph window |
void |
legend(int x,
int y,
java.lang.String text)
Define a data legend in the graph window |
void |
legendColor(java.awt.Color c)
Set the color for the legend text |
void |
legendFont(java.awt.Font f)
Set the font to be used in the legend |
protected void |
range(int stride)
Calculate the range of the data. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final int NOLINE
public static final int LINE
public Graph2D g2d
Graph2Dpublic int linestyle
public java.awt.Color linecolor
public int marker
Markerspublic java.awt.Color markercolor
public double markerscale
public Axis xaxis
Axispublic Axis yaxis
Axispublic double xmax
public double xmin
public double ymax
public double ymin
public boolean clipping
protected double dxmax
protected double dxmin
protected double dymax
protected double dymin
protected double[] data
protected int length
protected double xrange
protected double yrange
protected int legend_length
protected TextLine legend_text
protected int legend_ix
protected int legend_iy
protected double legend_dx
protected double legend_dy
protected int increment
protected int stride
| Constructor Detail |
|---|
public DataSet()
public DataSet(int stride)
throws java.lang.Exception
stride - the stride of the data set. The default stride is 2.
java.lang.Exception
public DataSet(double[] d,
int n)
throws java.lang.Exception
d - Array containing the (x,y) data pairs.n - Number of (x,y) data pairs in the array.
java.lang.Exception - A Generic exception if it fails to load the
parsed array into the class.
public DataSet(double[] d,
int n,
int s)
throws java.lang.Exception
d - Array containing the (x,y) data pairs.n - Number of (x,y) data pairs in the array.s - The stride of the data.
java.lang.Exception - A Generic exception if it fails to load the
parsed array into the class.| Method Detail |
|---|
public void append(double[] d,
int n)
throws java.lang.Exception
d - Array containing (x,y) pairs to appendn - Number of (x,y) data pairs in the array.
java.lang.Exception - A generic exception if it fails to load the
parsed array into the class.
public void delete(int start,
int end)
start - The start (x,y) pair index.end - The end (x,y) pair index.public void deleteData()
public void draw_data(java.awt.Graphics g,
java.awt.Rectangle bounds)
g - Graphics statebounds - The data window to draw intopublic double getXmax()
public double getXmin()
public double getYmax()
public double getYmin()
public void legend(int x,
int y,
java.lang.String text)
x - pixel position of the legend.y - pixel position of the legend.text - text to display in the legend
public void legend(double x,
double y,
java.lang.String text)
x - data position of the legend.y - data position of the legend.text - text to display in the legendpublic void legendFont(java.awt.Font f)
f - fontpublic void legendColor(java.awt.Color c)
c - colorpublic int dataPoints()
public double[] getPoint(int index)
index - Data point index
public double[] getClosestPoint(double x,
double y)
x - y - (x,y) position in data space.
protected void draw_lines(java.awt.Graphics g,
java.awt.Rectangle w)
g - Graphics contextw - Data window
protected boolean inside(double x,
double y)
protected void draw_markers(java.awt.Graphics g,
java.awt.Rectangle w)
g - Graphics contextw - data windowMarkers
protected void draw_legend(java.awt.Graphics g,
java.awt.Rectangle w)
g - Graphics contextw - Data Windowprotected void range(int stride)
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||