Class resample.RVHistogram
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class resample.RVHistogram

java.lang.Object
   |
   +----java.awt.Component
           |
           +----java.awt.Canvas
                   |
                   +----resample.RVHistogram

public class RVHistogram
extends Canvas
The histogram is implemented as subclass of Canvas. It is an abstract class. Derived subclasses have to implement the method calculateHistoArray individually. The constructors of the subclasses should contain the following code:

calculateHistoArray();
scaleYToPercent();


Variable Index

 o arrElements
 o rangeLeft
 o resVec
 o resVecSort
 o xDescription
 o xSize
 o xValue
 o ySize
 o yValue

Constructor Index

 o RVHistogram(int, int, ResampleVector)
constructor for abstract class:

xSize,ySize: canvas-dimension ResampleVector: vector with the data to present

Method Index

 o calculateDeltaX(Graphics, FontMetrics, int)
 o calculateDeltaY(Graphics, int)
 o calculateHistoArray()
the subclasses have to implement this method in order to calculate the x-and yValue-arrays
 o getValueArrayCapacity(ResampleVector)
 o getXValues()
Returns the x-Array of the histogram
 o getYValues(boolean)
Returns the y-Array of the histogram
 o minimumSize()
 o paint(Graphics)
Draws the histogram.
 o preferredSize()
 o scaleYToPercent()
 o setColor(Color, Color)
Sets color and backcolor.
 o setFont(String, int, int)
Sets new font with desired properties.
 o write(OutputStream)
Writes the histogram data to an output stream in the following form: value count
1 5 *****
2 10 **********
4 1 *
[.....................]

the values are listed line by line, the stars offer an immediate overview about the distribution

Variables

 o xSize
  protected int xSize
 o ySize
  protected int ySize
 o rangeLeft
  protected int rangeLeft
 o resVec
  protected ResampleVector resVec
 o xDescription
  protected String xDescription
 o xValue
  protected String xValue[]
 o yValue
  protected double yValue[]
 o arrElements
  protected int arrElements
 o resVecSort
  protected ResampleVector resVecSort

Constructors

 o RVHistogram
  public RVHistogram(int xSize,
                     int ySize,
                     ResampleVector resVec)
constructor for abstract class:

xSize,ySize: canvas-dimension ResampleVector: vector with the data to present

Methods

 o getXValues
  public String[] getXValues()
Returns the x-Array of the histogram
 o getYValues
  public double[] getYValues(boolean fRescaleToAbsolut)
Returns the y-Array of the histogram
Parameters:
fRescaleToAbsolut: - if true, return absolute values, else percent values
 o write
  public void write(OutputStream output) throws IOException
Writes the histogram data to an output stream in the following form: value count
1 5 *****
2 10 **********
4 1 *
[.....................]

the values are listed line by line, the stars offer an immediate overview about the distribution

 o preferredSize
  public Dimension preferredSize()
Overrides:
preferredSize in class Component
 o minimumSize
  public Dimension minimumSize()
Overrides:
minimumSize in class Component
 o setFont
  public void setFont(String fontName,
                      int fontStyle,
                      int fontSize)
Sets new font with desired properties.

Parameters: name, style and size of the font

 o setColor
  public void setColor(Color foreColor,
                       Color backColor)
Sets color and backcolor.
 o paint
  public void paint(Graphics g)
Draws the histogram.

It reads the data from the two arrays xValue and yValue which are filled by the method calculateHistoArray of the actual subclass. There are three predefinded subclasses: Linear, Compressed and PartSums.

Users of this package can define further subclasses by implementing a special calculation-method for presenting the data in exactly the way they want it. They just have to fill the two arrays individually.

All subclasses use the same paint-method. It starts with the first pair of array-elements and proceeds until the end of the array or the size of the canvas is reached.

Overrides:
paint in class Canvas
 o calculateDeltaX
  protected int calculateDeltaX(Graphics g,
                                FontMetrics fm,
                                int deltaCharX)
 o calculateDeltaY
  protected int calculateDeltaY(Graphics g,
                                int deltaCharY)
 o scaleYToPercent
  protected void scaleYToPercent()
 o calculateHistoArray
  protected abstract void calculateHistoArray()
the subclasses have to implement this method in order to calculate the x-and yValue-arrays
 o getValueArrayCapacity
  protected int getValueArrayCapacity(ResampleVector resVecSort)

All Packages  Class Hierarchy  This Package  Previous  Next  Index