Class graph.Axis
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class graph.Axis
java.lang.Object
   |
   +----graph.Axis
  -  public class Axis
  -  extends Object
This class controls the look and feel of axes. 
It is designed to be used in conjunction with 
the Graph2D class and DataSet class for plotting 2D graphs.
To work with the other classes a system of registration is used.
The axes have to be attached to the controlling Graph2D class
and the DataSet's have to be attached to both the Graph2D class
and the Axis class.
This way the 3 main classes Graph2D, Axis and DataSet know of each
others existence.
This does not mean the classes cannot be used independently, they can
but in this mode nothing is automated, the user must code everything
manually
  -  Version:
  
-  1.12, 1996/09/12 03:27:07.
  
-  Author:
  
-  Leigh Brookshaw
   
  -   amax amax
-  The position in pixels of the maximum point of the axis line
  
-   amin amin
-  The position in pixels of the minimum point of the axis line
  
-   axiscolor axiscolor
-  Color of the Axis.
  
-   BOTTOM BOTTOM
-     Constant flagging Axis position on the graph.
  
-   data_window data_window
-  Before the Axis can be positioned correctly and drawn the data window
needs to be calculated and passed to the Axis.
  
-   dataset dataset
-  Vector containing a list of attached DataSets
  
-   drawgrid drawgrid
-     If true draw a grid positioned on major ticks over the graph
  
-   drawzero drawzero
-     If true draw a line positioned on the Zero label tick mark.
  
-   exponent exponent
-  Textline class to hold the label's exponent (if it has one).
  
-   force_end_labels force_end_labels
-  Rescale the axis so that labels fall at the end of the Axis.
  
-   g2d g2d
-  The graph canvas this axis is attached to (if it is attached to any)
  
-   gridcolor gridcolor
-  Color of the grid
  
-   guess_label_number guess_label_number
-  Initial guess for the number of labels required
  
-   label label
-  Textline class to hold the labels before printing.
  
-   label_count label_count
-  The number of labels required
  
-   label_exponent label_exponent
-  The label exponent
  
-   label_start label_start
-  The starting value of the labels
  
-   label_step label_step
-  The increment between labels
  
-   label_string label_string
-  String to contain the labels.
  
-   label_value label_value
-  The actual values of the axis labels
  
-   LEFT LEFT
-     Constant flagging Axis position on the graph.
  
-   major_tic_size major_tic_size
-  Size in pixels of the major tick marks
  
-   manualRange manualRange
-  If true the axis range must be manually set by setting the
Axis.minimum and Axis.maximum variables.
  
-   max_label_width max_label_width
-  The width of the maximum label.
  
-   maximum maximum
-  Maximum data value of the axis.
  
-   minimum minimum
-  Minimum data value of the axis.
  
-   minor_tic_count minor_tic_count
-  Number of minor tick marks between major tick marks
  
-   minor_tic_size minor_tic_size
-  Size in pixels of the minor tick marks
  
-   orientation orientation
-  The orientation of the axis.
  
-   position position
-  The position of the axis.
  
-   redraw redraw
-  Default value true.
  
-   RIGHT RIGHT
-     Constant flagging Axis position on the graph.
  
-   title title
-  Textline class to contain the title of the axis.
  
-   TOP TOP
-     Constant flagging Axis position on the graph.
  
-   width width
-  The width of the Axis.
  
-   zerocolor zerocolor
-  Color of the line at the Zero label
   
  -   Axis() Axis()
-   Instantiate the class.
  
-   Axis(int) Axis(int)
-  Instantiate the class.
   
  -   attachDataSet(DataSet) attachDataSet(DataSet)
-  Attach a DataSet for the Axis to manage.
  
-   attachXdata(DataSet) attachXdata(DataSet)
-  Attach a DataSet to a Horizontal Axis
  
-   attachYdata(DataSet) attachYdata(DataSet)
-  Attach a DataSet to a Vertical Axis
  
-   calculateGridLabels() calculateGridLabels()
-  calculate the labels
  
-   detachAll() detachAll()
-  Detach All attached dataSets.
  
-   detachDataSet(DataSet) detachDataSet(DataSet)
-  Detach an attached DataSet
  
-   drawAxis(Graphics) drawAxis(Graphics)
-  Draw the axis using the passed Graphics context.
  
-   drawHAxis(Graphics) drawHAxis(Graphics)
-  Draw a Horizontal Axis.
  
-   drawVAxis(Graphics) drawVAxis(Graphics)
-  Draw a Vertical Axis.
  
-   getAxisPos() getAxisPos()
-  Return the position of the Axis.
  
-   getAxisWidth(Graphics) getAxisWidth(Graphics)
-  Return the width of the axis.
  
-   getDataMax() getDataMax()
-  Return the maximum value of All datasets attached to the axis.
  
-   getDataMin() getDataMin()
-  Return the minimum value of All datasets attached to the axis.
  
-   getDouble(int) getDouble(int)
-  Return the data value equivalent of the passed pixel position.
  
-   getInteger(double) getInteger(double)
-  Return the pixel equivalent of the passed data value.
  
-   isVertical() isVertical()
-  If the Axis is Vertical return true.
  
-   positionAxis(int, int, int, int) positionAxis(int, int, int, int)
-  Position the axis at the passed coordinates.
  
-   resetRange() resetRange()
-  Reset the range of the axis (the minimum and maximum values) to the
default data values.
  
-   setExponentColor(Color) setExponentColor(Color)
-  Set the color of the exponent
  
-   setExponentFont(Font) setExponentFont(Font)
-  Set the font of the exponent
  
-   setLabelColor(Color) setLabelColor(Color)
-  Set the color of the labels
  
-   setLabelFont(Font) setLabelFont(Font)
-  Set the font of the labels.
  
-   setManualRange(boolean) setManualRange(boolean)
-  Is the range of the axis to be set automatically (based on the data)
or manually by setting the values Axis.minimum and Axis.maximum?
  
-   setPosition(int) setPosition(int)
-  Set the axis position.
  
-   setTitleColor(Color) setTitleColor(Color)
-  Set the color of the title
  
-   setTitleFont(Font) setTitleFont(Font)
-  Set the font of the title
  
-   setTitleRotation(int) setTitleRotation(int)
-  Set the title rotation angle.
  
-   setTitleText(String) setTitleText(String)
-  Set the title of the axis
   
 LEFT
LEFT
  public final static int LEFT
  -  Constant flagging Axis position on the graph. 
   Left side => Vertical
 RIGHT
RIGHT
  public final static int RIGHT
  -  Constant flagging Axis position on the graph. 
   Right side => Vertical
 TOP
TOP
  public final static int TOP
  -  Constant flagging Axis position on the graph. 
   Top side => Horizontal
 BOTTOM
BOTTOM
  public final static int BOTTOM
  -  Constant flagging Axis position on the graph. 
   Bottom side => Horizontal
 drawgrid
drawgrid
  public boolean drawgrid
  -  If true draw a grid positioned on major ticks over the graph
 drawzero
drawzero
  public boolean drawzero
  -  If true draw a line positioned on the Zero label tick mark.
 gridcolor
gridcolor
  public Color gridcolor
  -  Color of the grid
 zerocolor
zerocolor
  public Color zerocolor
  -  Color of the line at the Zero label
 redraw
redraw
  public boolean redraw
  -  Default value true. Normally never changed. If set false
the Axis draw method exits without drawing the axis.
   
    -  See Also:
    
-  drawAxis
  
 
 force_end_labels
force_end_labels
  public boolean force_end_labels
  -  Rescale the axis so that labels fall at the end of the Axis. Default
value false.
 major_tic_size
major_tic_size
  public int major_tic_size
  -  Size in pixels of the major tick marks
 minor_tic_size
minor_tic_size
  public int minor_tic_size
  -  Size in pixels of the minor tick marks
 minor_tic_count
minor_tic_count
  public int minor_tic_count
  -  Number of minor tick marks between major tick marks
 axiscolor
axiscolor
  public Color axiscolor
  -  Color of the Axis.
 minimum
minimum
  public double minimum
  -  Minimum data value of the axis. This is the value used to scale
data into the data window. This is the value to alter to force
a rescaling of the data window.
 maximum
maximum
  public double maximum
  -  Maximum data value of the axis. This is the value used to scale
data into the data window. This is the value to alter to force
a rescaling of the data window.
 data_window
data_window
  public Dimension data_window
  -  Before the Axis can be positioned correctly and drawn the data window
needs to be calculated and passed to the Axis.
 g2d
g2d
  public Graph2D g2d
  -  The graph canvas this axis is attached to (if it is attached to any)
   
    -  See Also:
    
-  Graph2D
  
 
 amin
amin
  protected Point amin
  -  The position in pixels of the minimum point of the axis line
 amax
amax
  protected Point amax
  -  The position in pixels of the maximum point of the axis line
 orientation
orientation
  protected int orientation
  -  The orientation of the axis. Either Axis.HORIZONTAL or
Axis.VERTICAL
 position
position
  protected int position
  -  The position of the axis. Either Axis.LEFT, Axis.RIGHT, Axis.TOP, or
Axis.BOTTOM
 width
width
  protected int width
  -  The width of the Axis. Where width for a horizontal axis is really 
the height
 title
title
  protected RTextLine title
  -  Textline class to contain the title of the axis.
 label
label
  protected RTextLine label
  -  Textline class to hold the labels before printing.
 exponent
exponent
  protected RTextLine exponent
  -  Textline class to hold the label's exponent (if it has one).
 max_label_width
max_label_width
  protected int max_label_width
  -  The width of the maximum label. Used to position a Vertical Axis.
 dataset
dataset
  protected Vector dataset
  -  Vector containing a list of attached DataSets
 label_string
label_string
  protected String label_string[]
  -  String to contain the labels.
 label_value
label_value
  protected float label_value[]
  -  The actual values of the axis labels
 label_start
label_start
  protected double label_start
  -  The starting value of the labels
 label_step
label_step
  protected double label_step
  -  The increment between labels
 label_exponent
label_exponent
  protected int label_exponent
  -  The label exponent
 label_count
label_count
  protected int label_count
  -  The number of labels required
 guess_label_number
guess_label_number
  protected int guess_label_number
  -  Initial guess for the number of labels required
 manualRange
manualRange
  protected boolean manualRange
  -  If true the axis range must be manually set by setting the
Axis.minimum and Axis.maximum variables. The default is false.
The default action is for the axis range to be calculated everytime
a dataset is attached.
   
 Axis
Axis
  public Axis()
  -  Instantiate the class. The defalt type is a Horizontal axis
 positioned at the bottom of the graph.
 Axis
Axis
  public Axis(int p)
  -  Instantiate the class. Setting the position.
  
    -  Parameters:
    
-  p - Set the axis position. Must be one of Axis.BOTTOM,
Axis.TOP, Axis.LEFT, Axis.RIGHT, Axis.HORIZONTAL or Axis.VERTICAL.
If one of the latter two are used then Axis.BOTTOM or 
Axis.LEFT is assumed.
  
 
   
 setPosition
setPosition
  public void setPosition(int p)
  -  Set the axis position.
  
    -  Parameters:
    
-  p - Must be one of Axis.BOTTOM,
Axis.TOP, Axis.LEFT, Axis.RIGHT, Axis.HORIZONTAL or Axis.VERTICAL.
If one of the latter two are used then Axis.BOTTOM or 
Axis.LEFT is assumed.
  
 
 attachDataSet
attachDataSet
  public void attachDataSet(DataSet d)
  -  Attach a DataSet for the Axis to manage.
  
    -  Parameters:
    
-  d - dataSet to attach
    
-  See Also:
    
-  DataSet
  
 
 detachDataSet
detachDataSet
  public void detachDataSet(DataSet d)
  -  Detach an attached DataSet
  
    -  Parameters:
    
-  d - dataSet to detach
    
-  See Also:
    
-  DataSet
  
 
 detachAll
detachAll
  public void detachAll()
  -  Detach All attached dataSets.
 getDataMin
getDataMin
  public double getDataMin()
  -  Return the minimum value of All datasets attached to the axis.
  
    -  Returns:
    
-  Data minimum
  
 
 getDataMax
getDataMax
  public double getDataMax()
  -  Return the maximum value of All datasets attached to the axis.
  
    -  Returns:
    
-  Data maximum
  
 
 getInteger
getInteger
  public int getInteger(double v)
  -  Return the pixel equivalent of the passed data value. Using the 
position of the axis and the maximum and minimum values convert
the data value into a pixel value
  
    -  Parameters:
    
-  v - data value to convert
    
-  Returns:
    
-  equivalent pixel value
    
-  See Also:
    
-  getDouble
  
 
 getDouble
getDouble
  public double getDouble(int i)
  -  Return the data value equivalent of the passed pixel position.
Using the 
position of the axis and the maximum and minimum values convert
the pixel position into a data value
  
    -  Parameters:
    
-  i - pixel value
    
-  Returns:
    
-  equivalent data value
    
-  See Also:
    
-  getInteger
  
 
 resetRange
resetRange
  public void resetRange()
  -  Reset the range of the axis (the minimum and maximum values) to the
default data values.
 getAxisPos
getAxisPos
  public int getAxisPos()
  -  Return the position of the Axis.
  
    -  Returns:
    
-  One of Axis.LEFT, Axis.RIGHT, Axis.TOP, or Axis.BOTTOM.
  
 
 isVertical
isVertical
  public boolean isVertical()
  -  If the Axis is Vertical return true.
 getAxisWidth
getAxisWidth
  public int getAxisWidth(Graphics g)
  -  Return the width of the axis.
  
    -  Parameters:
    
-  g - graphics context.
  
 
 positionAxis
positionAxis
  public boolean positionAxis(int xmin,
                              int xmax,
                              int ymin,
                              int ymax)
  -  Position the axis at the passed coordinates. The coordinates should match
the type of axis.
  
    -  Parameters:
    
-  xmin - The minimum X pixel
    -  xmax - The maximum X pixel. These should be equal if the axis 
        is vertical
    -  ymin - The minimum Y pixel
    -  ymax - The maximum Y pixel. These should be equal if the axis 
        is horizontal
    
-  Returns:
    
-  true if there are no inconsistencies.
  
 
 drawAxis
drawAxis
  public void drawAxis(Graphics g)
  -  Draw the axis using the passed Graphics context.
  
    -  Parameters:
    
-  g - Graphics context for drawing
  
 
 setTitleText
setTitleText
  public void setTitleText(String s)
  -  Set the title of the axis
  
    -  Parameters:
    
-  s - string containing text.
  
 
 setTitleColor
setTitleColor
  public void setTitleColor(Color c)
  -  Set the color of the title
  
    -  Parameters:
    
-  c - Color of the title.
  
 
 setTitleFont
setTitleFont
  public void setTitleFont(Font f)
  -  Set the font of the title
  
    -  Parameters:
    
-  c - Title font.
  
 
 setTitleRotation
setTitleRotation
  public void setTitleRotation(int a)
  -  Set the title rotation angle. Only multiples of 90 degrees allowed.
  
    -  Parameters:
    
-  a - Title rotation angle in degrees.
  
 
 setLabelColor
setLabelColor
  public void setLabelColor(Color c)
  -  Set the color of the labels
  
    -  Parameters:
    
-  c - Color of the labels.
  
 
 setLabelFont
setLabelFont
  public void setLabelFont(Font f)
  -  Set the font of the labels.
  
    -  Parameters:
    
-  f - font.
  
 
 setExponentColor
setExponentColor
  public void setExponentColor(Color c)
  -  Set the color of the exponent
  
    -  Parameters:
    
-  c - Color.
  
 
 setExponentFont
setExponentFont
  public void setExponentFont(Font f)
  -  Set the font of the exponent
  
    -  Parameters:
    
-  f - font.
  
 
 setManualRange
setManualRange
  public void setManualRange(boolean b)
  -  Is the range of the axis to be set automatically (based on the data)
or manually by setting the values Axis.minimum and Axis.maximum?
  
    -  Parameters:
    
-  b - boolean value.
  
 
 drawHAxis
drawHAxis
  protected void drawHAxis(Graphics g)
  -  Draw a Horizontal Axis.
  
    -  Parameters:
    
-  g - Graphics context.
  
 
 drawVAxis
drawVAxis
  protected void drawVAxis(Graphics g)
  -  Draw a Vertical Axis.
  
    -  Parameters:
    
-  g - Graphics context.
  
 
 attachXdata
attachXdata
  protected void attachXdata(DataSet d)
  -  Attach a DataSet to a Horizontal Axis
  
    -  Parameters:
    
-  d - dataset to attach.
  
 
 attachYdata
attachYdata
  protected void attachYdata(DataSet d)
  -  Attach a DataSet to a Vertical Axis
  
    -  Parameters:
    
-  d - dataset to attach.
  
 
 calculateGridLabels
calculateGridLabels
  protected void calculateGridLabels()
  -  calculate the labels
All Packages  Class Hierarchy  This Package  Previous  Next  Index