net.moioli.drawables
Class Axes

java.lang.Object
  extended by net.moioli.drawables.Axes
All Implemented Interfaces:
DrawableI

public class Axes
extends java.lang.Object
implements DrawableI

Represents the x and y axes of the DefaultChart, their measure units, and their legend.

Version:
2005/10/5
Author:
Silvio Moioli

Constructor Summary
Axes()
          Default constructor.
 
Method Summary
 void drawMe(GraphicsI g, Scale s, java.lang.Object c)
          This method is automatically called by DefaultChart to draw the objects it contains, so end users should never call drawMe directly.
 double maxY(double minX, double maxX)
          Since the axis will be drawn regardless of the scale, always return NaN.
 double minY(double minX, double maxX)
          Since the axis will be drawn regardless of the scale, always return NaN.
 double xMeasureUnitValue(Scale s)
          This object will divide both x and y axes in a number of segments, each one representing a measure unit described in the Legend, to make the DefaultChart easier to read.
 int xMeasureUnitWidth(Scale s)
          This object will divide both x and y axes in a number of segments, each one representing a measure unit described in the Legend, to make the DefaultChart easier to read.
 double yMeasureUnitValue(Scale s)
          This object will divide both x and y axes in a number of segments, each one representing a measure unit described in the Legend, to make the DefaultChart easier to read.
 int yMeasureUnitWidth(Scale s)
          This object will divide both x and y axes in a number of segments, each one representing a measure unit described in the Legend, to make the DefaultChart easier to read.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Axes

public Axes()
Default constructor.

Method Detail

xMeasureUnitWidth

public int xMeasureUnitWidth(Scale s)
This object will divide both x and y axes in a number of segments, each one representing a measure unit described in the Legend, to make the DefaultChart easier to read. This method calculates the number of pixels corresponding to this-DefaultChart's-x-axis measure unit.

Parameters:
s - the DefaultChart's Scale object
Returns:
the width of a measure unit in this DefaultChart.

yMeasureUnitWidth

public int yMeasureUnitWidth(Scale s)
This object will divide both x and y axes in a number of segments, each one representing a measure unit described in the Legend, to make the DefaultChart easier to read. This method calculates the number of pixels corresponding to this-DefaultChart's-y-axis measure unit.

Parameters:
s - the DefaultChart's Scale object
Returns:
the width of a measure unit in this DefaultChart.

xMeasureUnitValue

public double xMeasureUnitValue(Scale s)
This object will divide both x and y axes in a number of segments, each one representing a measure unit described in the Legend, to make the DefaultChart easier to read. This calculates the width of an x axis segment on the DefaultChart (not the number of pixels).

Parameters:
s - the DefaultChart's Scale object
Returns:
width of a segment

yMeasureUnitValue

public double yMeasureUnitValue(Scale s)
This object will divide both x and y axes in a number of segments, each one representing a measure unit described in the Legend, to make the DefaultChart easier to read. This calculates the width of an y axis segment on the DefaultChart (not the number of pixels).

Parameters:
s - the DefaultChart's Scale object
Returns:
width of a segment

drawMe

public void drawMe(GraphicsI g,
                   Scale s,
                   java.lang.Object c)
Description copied from interface: DrawableI
This method is automatically called by DefaultChart to draw the objects it contains, so end users should never call drawMe directly. Inside this method there must be all the code to draw the object on a DefaultChart, and all the operations which involve scaling should be done via the passed Scale object.

Specified by:
drawMe in interface DrawableI
Parameters:
g - the surface where this object will be drawn
s - the DefaultChart's Scale object
c - the color to be used for drawing
See Also:
DrawableI.drawMe(GraphicsI, Scale, Object)

maxY

public double maxY(double minX,
                   double maxX)
Since the axis will be drawn regardless of the scale, always return NaN.

Specified by:
maxY in interface DrawableI
Parameters:
minX - the minimum x value represented in this DefaultChart
maxX - the maximum x value represented in this DefaultChart
Returns:
NaN

minY

public double minY(double minX,
                   double maxX)
Since the axis will be drawn regardless of the scale, always return NaN.

Specified by:
minY in interface DrawableI
Parameters:
minX - the minimum x value represented in this DefaultChart
maxX - the maximum x value represented in this DefaultChart
Returns:
NaN