Class graph.DataSet
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class graph.DataSet
java.lang.Object
   |
   +----graph.DataSet
  -  public class DataSet
  -  extends Object
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.
  -  Version:
  
-  1.15, 1996/09/24 05:23:41
  
-  Author:
  
-  Leigh Brookshaw
   
  -   clipping clipping
-  Boolean to control clipping of the data window.
  
-   data data
-  The array containing the actual data 
  
-   dxmax dxmax
-  The data X maximum.
  
-   dxmin dxmin
-  The data X minimum.
  
-   dymax dymax
-  The data Y maximum.
  
-   dymin dymin
-  The data Y minimum.
  
-   g2d g2d
-  
   The Graphics canvas that is driving the whole show.
  
-   increment increment
-     The amount to increment the data array when the append method is being
   used.
  
-   legend_dx legend_dx
-  The X data position of the data legend
  
-   legend_dy legend_dy
-  The Y data position of the data legend
  
-   legend_ix legend_ix
-  The X pixel position of the data legend
  
-   legend_iy legend_iy
-  The Y pixel position of the data legend
  
-   legend_length legend_length
-     The length of the example line in the data legend.
  
-   legend_text legend_text
-     The legend text
  
-   length length
-  The number of data points stored in the data array
  
-   LINE LINE
-     A constant value flag used to specify that a straight line segment
   is to join the data points.
  
-   linecolor linecolor
-     The color of the straight line segments
  
-   linestyle linestyle
-     The linestyle to employ when joining the data points with
   straight line segments.
  
-   marker marker
-     The index of the marker to use at the data points.
  
-   markercolor markercolor
-     The marker color
  
-   markerscale markerscale
-     The scaling factor for the marker.
  
-   NOLINE NOLINE
-     A constant value flag used to specify no straight line segment
   is to join the data points
  
-   stride stride
-  The stride of the data.
  
-   xaxis xaxis
-     The Axis object the X data is attached to.
  
-   xmax xmax
-  The current plottable X maximum of the data.
  
-   xmin xmin
-  The current plottable X minimum of the data.
  
-   xrange xrange
-     The X range of the clipped data
  
-   yaxis yaxis
-     The Axis object the Y data is attached to.
  
-   ymax ymax
-  The current plottable Y maximum of the data.
  
-   ymin ymin
-  The current plottable Y minimum of the data.
  
-   yrange yrange
-     The Y range of the clipped data
   
  -   DataSet() DataSet()
-   Instantiate an empty data set.
  
-   DataSet(double[], int) DataSet(double[], int)
-  Instantiate a DataSet with the parsed data.
  
-   DataSet(double[], int, int) DataSet(double[], int, int)
-  Instantiate a DataSet with the parsed data.
  
-   DataSet(int) DataSet(int)
-   Instantiate an empty data set.
   
  -   append(double[], int) append(double[], int)
-  Append data to the data set.
  
-   dataPoints() dataPoints()
-  Return the number of data points in the DataSet
  
-   delete(int, int) delete(int, int)
-  Delete data from the data set (start and end are inclusive).
  
-   deleteData() deleteData()
-  Delete all the data from the data set.
  
-   draw_data(Graphics, Rectangle) draw_data(Graphics, Rectangle)
-  Draw the straight line segments and/or the markers at the
data points.
  
-   draw_legend(Graphics, Rectangle) draw_legend(Graphics, Rectangle)
-  Draw a legend for this data set
  
-   draw_lines(Graphics, Rectangle) draw_lines(Graphics, Rectangle)
-  Draw into the data window the straight line segments joining the
data points.
  
-   draw_markers(Graphics, Rectangle) draw_markers(Graphics, Rectangle)
-   Draw the markers.
  
-   getClosestPoint(double, double) getClosestPoint(double, double)
-  Return the data point that is closest to the parsed (x,y) position
  
-   getPoint(int) getPoint(int)
-  get the data point at the parsed index.
  
-   getXmax() getXmax()
-  return the data X maximum.
  
-   getXmin() getXmin()
-  return the data X minimum.
  
-   getYmax() getYmax()
-  return the data Y maximum.
  
-   getYmin() getYmin()
-  return the data Y minimum.
  
-   inside(double, double) inside(double, double)
-   Return true if the point (x,y) is inside the allowed data range.
  
-   legend(double, double, String) legend(double, double, String)
-  Define a data legend in the graph window
  
-   legend(int, int, String) legend(int, int, String)
-  Define a data legend in the graph window
  
-   legendColor(Color) legendColor(Color)
-  Set the color for the legend text
  
-   legendFont(Font) legendFont(Font)
-  Set the font to be used in the legend
  
-   range(int) range(int)
-  Calculate the range of the data.
   
 NOLINE
NOLINE
  public final static int NOLINE
  -  A constant value flag used to specify no straight line segment
   is to join the data points
 LINE
LINE
  public final static int LINE
  -  A constant value flag used to specify that a straight line segment
   is to join the data points.
 g2d
g2d
  public Graph2D g2d
  -  The Graphics canvas that is driving the whole show.
   
    -  See Also:
    
-  Graph2D
  
 
 linestyle
linestyle
  public int linestyle
  -  The linestyle to employ when joining the data points with
   straight line segments. Currently only solid and no line
   are supported.
 linecolor
linecolor
  public Color linecolor
  -  The color of the straight line segments
 marker
marker
  public int marker
  -  The index of the marker to use at the data points.
   
    -  See Also:
    
-  Markers
  
 
 markercolor
markercolor
  public Color markercolor
  -  The marker color
 markerscale
markerscale
  public double markerscale
  -  The scaling factor for the marker. Default value is 1.
 xaxis
xaxis
  public Axis xaxis
  -  The Axis object the X data is attached to. From the Axis object
   the scaling for the data can be derived.
   
    -  See Also:
    
-  Axis
  
 
 yaxis
yaxis
  public Axis yaxis
  -  The Axis object the Y data is attached to.
   
    -  See Also:
    
-  Axis
  
 
 xmax
xmax
  public double xmax
  -  The current plottable X maximum of the data. 
This can be very different from
true data X maximum. The data is clipped when plotted.
 xmin
xmin
  public double xmin
  -  The current plottable X minimum of the data. 
This can be very different from
true data X minimum. The data is clipped when plotted.
 ymax
ymax
  public double ymax
  -  The current plottable Y maximum of the data. 
This can be very different from
true data Y maximum. The data is clipped when plotted.
 ymin
ymin
  public double ymin
  -  The current plottable Y minimum of the data. 
This can be very different from
true data Y minimum. The data is clipped when plotted.
 clipping
clipping
  public boolean clipping
  -  Boolean to control clipping of the data window.
Default value is true, clip the data window.
 dxmax
dxmax
  protected double dxmax
  -  The data X maximum. 
Once the data is loaded this will never change.
 dxmin
dxmin
  protected double dxmin
  -  The data X minimum. 
Once the data is loaded this will never change.
 dymax
dymax
  protected double dymax
  -  The data Y maximum. 
Once the data is loaded this will never change.
 dymin
dymin
  protected double dymin
  -  The data Y minimum. 
Once the data is loaded this will never change.
 data
data
  protected double data[]
  -  The array containing the actual data
 length
length
  protected int length
  -  The number of data points stored in the data array
 xrange
xrange
  protected double xrange
  -  The X range of the clipped data
 yrange
yrange
  protected double yrange
  -  The Y range of the clipped data
 legend_length
legend_length
  protected int legend_length
  -  The length of the example line in the data legend.
 legend_text
legend_text
  protected TextLine legend_text
  -  The legend text
 legend_ix
legend_ix
  protected int legend_ix
  -  The X pixel position of the data legend
 legend_iy
legend_iy
  protected int legend_iy
  -  The Y pixel position of the data legend
 legend_dx
legend_dx
  protected double legend_dx
  -  The X data position of the data legend
 legend_dy
legend_dy
  protected double legend_dy
  -  The Y data position of the data legend
 increment
increment
  protected int increment
  -  The amount to increment the data array when the append method is being
   used.
 stride
stride
  protected int stride
  -  The stride of the data. For data pairs (x,y) the stride is 2
   
 DataSet
DataSet
  public DataSet()
  -  Instantiate an empty data set.
 DataSet
DataSet
  public DataSet(int stride) throws Exception
  -  Instantiate an empty data set.
 @param stride the stride of the data set. The default stride is 2.
 DataSet
DataSet
  public DataSet(double d[],
                 int n) throws Exception
  -  Instantiate a DataSet with the parsed data. Default stride is 2.
The double array contains the data. The X data is expected in
the even indices, the y data in the odd. The integer n is the
number of data Points. This means that the length of the data
array is 2*n.
  
    -  Parameters:
    
-  d - Array containing the (x,y) data pairs.
    -  n - Number of (x,y) data pairs in the array.
    
-  Throws: Exception
    
-  A Generic exception if it fails to load the
           parsed array into the class.
  
 
 DataSet
DataSet
  public DataSet(double d[],
                 int n,
                 int s) throws Exception
  -  Instantiate a DataSet with the parsed data.
The double array contains the data. The X data is expected to be in
indices i*stride where i=0,1,... The Y data is expected to be found
in indices i*stride+1 where i=0,1,2...
The integer n is the
number of data Points. This means that the length of the data
array is 2*stride.
  
    -  Parameters:
    
-  d - Array containing the (x,y) data pairs.
    -  n - Number of (x,y) data pairs in the array.
    -  s - The stride of the data.
    
-  Throws: Exception
    
-  A Generic exception if it fails to load the
           parsed array into the class.
  
 
   
 append
append
  public void append(double d[],
                     int n) throws Exception
  -  Append data to the data set.
  
    -  Parameters:
    
-  d - Array containing (x,y) pairs to append
    -  n - Number of (x,y) data pairs in the array.
    
-  Throws: Exception
    
-  A generic exception if it fails to load the
           parsed array into the class.
  
 
 delete
delete
  public void delete(int start,
                     int end)
  -  Delete data from the data set (start and end are inclusive).
The first (x,y) pair in the data set start at index 0.
  
    -  Parameters:
    
-  start - The start (x,y) pair index.
    -  end - The end (x,y) pair index.
  
 
 deleteData
deleteData
  public void deleteData()
  -  Delete all the data from the data set.
 draw_data
draw_data
  public void draw_data(Graphics g,
                        Rectangle bounds)
  -  Draw the straight line segments and/or the markers at the
data points.
If this data has been attached to an Axis then scale the data
based on the axis maximum/minimum otherwise scale using
the data's maximum/minimum
  
    -  Parameters:
    
-  g - Graphics state
    -  bounds - The data window to draw into
  
 
 getXmax
getXmax
  public double getXmax()
  -  return the data X maximum.
 getXmin
getXmin
  public double getXmin()
  -  return the data X minimum.
 getYmax
getYmax
  public double getYmax()
  -  return the data Y maximum.
 getYmin
getYmin
  public double getYmin()
  -  return the data Y minimum.
 legend
legend
  public void legend(int x,
                     int y,
                     String text)
  -  Define a data legend in the graph window
  
    -  Parameters:
    
-  x - pixel position of the legend.
    -  y - pixel position of the legend.
    -  text - text to display in the legend
  
 
 legend
legend
  public void legend(double x,
                     double y,
                     String text)
  -  Define a data legend in the graph window
  
    -  Parameters:
    
-  x - data position of the legend.
    -  y - data position of the legend.
    -  text - text to display in the legend
  
 
 legendFont
legendFont
  public void legendFont(Font f)
  -  Set the font to be used in the legend
  
    -  Parameters:
    
-  f - font
  
 
 legendColor
legendColor
  public void legendColor(Color c)
  -  Set the color for the legend text
  
    -  Parameters:
    
-  c - color
  
 
 dataPoints
dataPoints
  public int dataPoints()
  -  Return the number of data points in the DataSet
  
    -  Returns:
    
-  number of (x,y0 points.
  
 
 getPoint
getPoint
  public double[] getPoint(int index)
  -  get the data point at the parsed index. The first (x,y) pair
is at index 0.
  
    -  Parameters:
    
-  index - Data point index
    
-  Returns:
    
-  array containing the (x,y) pair.
  
 
 getClosestPoint
getClosestPoint
  public double[] getClosestPoint(double x,
                                  double y)
  -  Return the data point that is closest to the parsed (x,y) position
  
    -  Parameters:
    
-  y - (x,y) position in data space.
    
-  Returns:
    
-  array containing the closest data point.
  
 
 draw_lines
draw_lines
  protected void draw_lines(Graphics g,
                            Rectangle w)
  -  Draw into the data window the straight line segments joining the
data points.
  
    -  Parameters:
    
-  g - Graphics context
    -  w - Data window
  
 
 inside
inside
  protected boolean inside(double x,
                           double y)
  -  Return true if the point (x,y) is inside the allowed data range.
 draw_markers
draw_markers
  protected void draw_markers(Graphics g,
                              Rectangle w)
  -  Draw the markers.
 Only markers inside the specified range will be drawn. Also markers
 close the edge of the clipping region will be clipped.
  
    -  Parameters:
    
-  g - Graphics context
    -  w - data window
    
-  See Also:
    
-  Markers
  
 
 draw_legend
draw_legend
  protected void draw_legend(Graphics g,
                             Rectangle w)
  -  Draw a legend for this data set
  
    -  Parameters:
    
-  g - Graphics context
    -  w - Data Window
  
 
 range
range
  protected void range(int stride)
  -  Calculate the range of the data. This modifies dxmin,dxmax,dymin,dymax
and xmin,xmax,ymin,ymax
All Packages  Class Hierarchy  This Package  Previous  Next  Index