net.moioli.chart
Class AbstractChart

java.lang.Object
  extended by java.util.AbstractCollection<E>
      extended by java.util.AbstractSet<E>
          extended by java.util.HashSet
              extended by net.moioli.chart.AbstractChart
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, java.lang.Iterable, java.util.Collection, java.util.Set, ChartI
Direct Known Subclasses:
DefaultChart

public abstract class AbstractChart
extends java.util.HashSet
implements ChartI

An AbstractChart is a Collection of drawable objects (instances of classes implementing the DrawableI interface). You can use all the Collection methods on an AbstractChart, but probably only DrawableI objects will be drawn.
You just have to implement the drawMe() method, where you'll most probably draw the Axes or a Legend after having created an appropriate Scale object. For an example implementation, see the DefaultChart class.

Version:
2005/10/5
Author:
Silvio Moioli
See Also:
DrawableI, GraphicsI, Serialized Form

Constructor Summary
AbstractChart()
          Default constructor.
 
Method Summary
 boolean add(java.lang.Object arg0)
           
abstract  void drawMe(GraphicsI g, IntRectangle clip)
          Draws this DefaultChart on the passed GraphicsI surface.
 double getMaxX()
          Returns the maximum x value represented.
 double getMaxY()
          Returns the maximum y value represented.
 double getMinX()
          Returns the minimum x value represented.
 double getMinY()
          Returns the minimum y value represented.
 int getPixelAccuracy()
          Returns the pixelAccuracy value.
 void setMaxX(double maxX)
          Returns the maximum x value represented.
 void setMaxY(double maxY)
          The maximum y value to be represented.
 void setMinX(double minX)
          The minimum x value to be represented.
 void setMinY(double minY)
          The minimum y value represented.
 void setPixelAccuracy(int pixelAccuracy)
          The pixelAccuracy to set.
 
Methods inherited from class java.util.HashSet
clear, clone, contains, isEmpty, iterator, remove, size
 
Methods inherited from class java.util.AbstractSet
equals, hashCode, removeAll
 
Methods inherited from class java.util.AbstractCollection
addAll, containsAll, retainAll, toArray, toArray, toString
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface java.util.Set
addAll, containsAll, equals, hashCode, removeAll, retainAll, toArray, toArray
 

Constructor Detail

AbstractChart

public AbstractChart()
Default constructor.

Method Detail

drawMe

public abstract void drawMe(GraphicsI g,
                            IntRectangle clip)
Description copied from interface: ChartI
Draws this DefaultChart on the passed GraphicsI surface.

Specified by:
drawMe in interface ChartI
Parameters:
g - the surface where this DefaultChart will be drawn
clip - the clipping rectangle to be used for drawing
See Also:
ChartI.drawMe(net.moioli.chart.GraphicsI, net.moioli.chart.IntRectangle)

getMaxX

public double getMaxX()
Description copied from interface: ChartI
Returns the maximum x value represented.

Specified by:
getMaxX in interface ChartI
Returns:
Returns the maximum x value represented.
See Also:
ChartI.getMaxX()

setMaxX

public void setMaxX(double maxX)
Description copied from interface: ChartI
Returns the maximum x value represented.

Specified by:
setMaxX in interface ChartI
Parameters:
maxX - The maximum x value represented.
See Also:
ChartI.setMaxX(double)

getMinX

public double getMinX()
Description copied from interface: ChartI
Returns the minimum x value represented.

Specified by:
getMinX in interface ChartI
Returns:
Returns the minimum x value represented.
See Also:
ChartI.getMinX()

setMinX

public void setMinX(double minX)
Description copied from interface: ChartI
The minimum x value to be represented.

Specified by:
setMinX in interface ChartI
Parameters:
minX - The minimum x value represented.
See Also:
ChartI.setMinX(double)

getMaxY

public double getMaxY()
Description copied from interface: ChartI
Returns the maximum y value represented.

Specified by:
getMaxY in interface ChartI
Returns:
Returns the maximum y value represented.
See Also:
ChartI.getMaxY()

setMaxY

public void setMaxY(double maxY)
Description copied from interface: ChartI
The maximum y value to be represented.

Specified by:
setMaxY in interface ChartI
Parameters:
maxY - The maximum y value represented.
See Also:
ChartI.setMaxY(double)

getMinY

public double getMinY()
Description copied from interface: ChartI
Returns the minimum y value represented.

Specified by:
getMinY in interface ChartI
Returns:
Returns the minimum y value represented.
See Also:
ChartI.getMinY()

setMinY

public void setMinY(double minY)
Description copied from interface: ChartI
The minimum y value represented.

Specified by:
setMinY in interface ChartI
Parameters:
minY - The minimum y value represented.
See Also:
ChartI.setMinY(double)

getPixelAccuracy

public int getPixelAccuracy()
Description copied from interface: ChartI
Returns the pixelAccuracy value. To draw mathematical functions, DefaultChart will calculate the value of the function multiple times. This parameter assigns the the number of pixels on the x axis after which the y value will be recalculated. 1 is the minimum possible value (maximum precision), 3 is recommended in most cases.

Specified by:
getPixelAccuracy in interface ChartI
Returns:
pixelAccuracy
See Also:
ChartI.getPixelAccuracy()

setPixelAccuracy

public void setPixelAccuracy(int pixelAccuracy)
Description copied from interface: ChartI
The pixelAccuracy to set. To draw mathematical functions, DefaultChart will calculate the value of the function multiple times. This parameter assigns the the number of pixels on the x axis after which the y value will be recalculated. 1 is the minimum possible value (maximum precision), 3 is recommended in most cases.

Specified by:
setPixelAccuracy in interface ChartI
See Also:
ChartI.setPixelAccuracy(int)

add

public boolean add(java.lang.Object arg0)
Specified by:
add in interface java.util.Collection
Specified by:
add in interface java.util.Set
Specified by:
add in interface ChartI
Overrides:
add in class java.util.HashSet
See Also:
ChartI.add(java.lang.Object)