org.jfree.chart.axis
Class CategoryAxis

java.lang.Object
  |
  +--org.jfree.chart.axis.Axis
        |
        +--org.jfree.chart.axis.CategoryAxis
All Implemented Interfaces:
AxisConstants, java.io.Serializable
Direct Known Subclasses:
HorizontalCategoryAxis, VerticalCategoryAxis

public abstract class CategoryAxis
extends Axis
implements java.io.Serializable

The base class for axes that display categories.

Author:
David Gilbert
See Also:
Serialized Form

Field Summary
static double DEFAULT_AXIS_MARGIN
          The default margin for the axis (used for both lower and upper margins).
static double DEFAULT_CATEGORY_MARGIN
          The default margin between categories (a percentage of the overall axis length).
 
Fields inherited from interface org.jfree.chart.axis.AxisConstants
BOTTOM, DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_AXIS_VISIBLE, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_LABELS_VISIBLE, DEFAULT_TICK_MARK_INSIDE_LENGTH, DEFAULT_TICK_MARK_OUTSIDE_LENGTH, DEFAULT_TICK_MARK_PAINT, DEFAULT_TICK_MARK_STROKE, DEFAULT_TICK_MARKS_VISIBLE, LEFT, RIGHT, TOP
 
Constructor Summary
protected CategoryAxis(java.lang.String label)
          Constructs a category axis, using default values where necessary.
 
Method Summary
 boolean equals(java.lang.Object obj)
          Tests this axis for equality with another object.
abstract  double getCategoryEnd(int category, int categoryCount, java.awt.geom.Rectangle2D area)
          Returns the end coordinate for the specified category.
 double getCategoryMargin()
          Returns the category margin.
abstract  double getCategoryMiddle(int category, int categoryCount, java.awt.geom.Rectangle2D area)
          Returns the middle coordinate for the specified category.
abstract  double getCategoryStart(int category, int categoryCount, java.awt.geom.Rectangle2D area)
          Returns the starting coordinate for the specified category.
 double getLowerMargin()
          Returns the lower margin for the axis.
 double getUpperMargin()
          Returns the upper margin for the axis.
 void setCategoryMargin(double margin)
          Sets the category margin.
 void setLowerMargin(double margin)
          Sets the lower margin for the axis.
 void setUpperMargin(double margin)
          Sets the upper margin for the axis.
 
Methods inherited from class org.jfree.chart.axis.Axis
addChangeListener, configure, draw, drawHorizontalLabel, drawVerticalLabel, getFixedDimension, getLabel, getLabelFont, getLabelInsets, getLabelPaint, getMaxTickLabelWidth, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, getTicks, isCompatiblePlot, isTickLabelsVisible, isTickMarksVisible, isVisible, notifyListeners, refreshTicks, removeChangeListener, setFixedDimension, setLabel, setLabelFont, setLabelInsets, setLabelPaint, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisible
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_AXIS_MARGIN

public static final double DEFAULT_AXIS_MARGIN
The default margin for the axis (used for both lower and upper margins).

See Also:
Constant Field Values

DEFAULT_CATEGORY_MARGIN

public static final double DEFAULT_CATEGORY_MARGIN
The default margin between categories (a percentage of the overall axis length).

See Also:
Constant Field Values
Constructor Detail

CategoryAxis

protected CategoryAxis(java.lang.String label)
Constructs a category axis, using default values where necessary.

Parameters:
label - the axis label.
Method Detail

getLowerMargin

public double getLowerMargin()
Returns the lower margin for the axis.

Returns:
the margin.

setLowerMargin

public void setLowerMargin(double margin)
Sets the lower margin for the axis. An AxisChangeEvent is sent to all registered listeners.

Parameters:
margin - the new margin.

getUpperMargin

public double getUpperMargin()
Returns the upper margin for the axis.

Returns:
the margin.

setUpperMargin

public void setUpperMargin(double margin)
Sets the upper margin for the axis. An AxisChangeEvent is sent to all registered listeners.

Parameters:
margin - the new margin.

getCategoryMargin

public double getCategoryMargin()
Returns the category margin.

Returns:
the margin.

setCategoryMargin

public void setCategoryMargin(double margin)
Sets the category margin. An AxisChangeEvent is sent to all registered listeners.

Parameters:
margin - the new margin.

getCategoryStart

public abstract double getCategoryStart(int category,
                                        int categoryCount,
                                        java.awt.geom.Rectangle2D area)
Returns the starting coordinate for the specified category.

Parameters:
category - the category.
categoryCount - the number of categories.
area - the data area.
Returns:
The coordinate.

getCategoryMiddle

public abstract double getCategoryMiddle(int category,
                                         int categoryCount,
                                         java.awt.geom.Rectangle2D area)
Returns the middle coordinate for the specified category.

Parameters:
category - the category.
categoryCount - the number of categories.
area - the data area.
Returns:
The coordinate.

getCategoryEnd

public abstract double getCategoryEnd(int category,
                                      int categoryCount,
                                      java.awt.geom.Rectangle2D area)
Returns the end coordinate for the specified category.

Parameters:
category - the category.
categoryCount - the number of categories.
area - the data area.
Returns:
The coordinate.

equals

public boolean equals(java.lang.Object obj)
Tests this axis for equality with another object.

Overrides:
equals in class Axis
Parameters:
obj - the object.
Returns:
true or false.