org.jfree.chart.axis
Class VerticalCategoryAxis

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

public class VerticalCategoryAxis
extends CategoryAxis
implements VerticalAxis, java.io.Serializable

A vertical axis that displays categories, used for horizontal bar charts.

Author:
David Gilbert
See Also:
Serialized Form

Field Summary
static boolean DEFAULT_VERTICAL_LABEL
          The default setting for vertical axis label.
 
Fields inherited from class org.jfree.chart.axis.CategoryAxis
DEFAULT_AXIS_MARGIN, DEFAULT_CATEGORY_MARGIN
 
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
VerticalCategoryAxis(java.lang.String label)
          Constructs a new axis, using default attributes where necessary.
 
Method Summary
 void configure()
          Configures the axis against the current plot.
 void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, int location)
          Draws the axis on a Java 2D graphics device (such as the screen or a printer).
 double getCategoryEnd(int category, int categoryCount, java.awt.geom.Rectangle2D area)
          Returns the end coordinate for the specified category.
 double getCategoryMiddle(int category, int categoryCount, java.awt.geom.Rectangle2D area)
          Returns the middle coordinate for the specified category.
 double getCategoryStart(int category, int categoryCount, java.awt.geom.Rectangle2D area)
          Returns the starting coordinate for the specified category.
protected  boolean isCompatiblePlot(Plot plot)
          Returns true if the specified plot is compatible with the axis, and false otherwise.
 boolean isVerticalLabel()
          Returns a flag indicating whether or not the axis label is drawn vertically.
 void refreshTicks(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D plotArea, int location)
          Creates a temporary list of ticks that can be used when drawing the axis.
 double reserveWidth(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D drawArea, int location)
          Estimates the height required for the axis, given a specific drawing area, without any information about the width of the vertical axis.
 double reserveWidth(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D drawArea, int location, double reservedHeight, int horizontalAxisLocation)
          Returns the area required to draw the axis in the specified draw area.
 void setVerticalLabel(boolean flag)
          Sets a flag indicating whether or not the axis label is drawn vertically.
 
Methods inherited from class org.jfree.chart.axis.CategoryAxis
equals, getCategoryMargin, getLowerMargin, getUpperMargin, setCategoryMargin, setLowerMargin, setUpperMargin
 
Methods inherited from class org.jfree.chart.axis.Axis
addChangeListener, drawHorizontalLabel, drawVerticalLabel, getFixedDimension, getLabel, getLabelFont, getLabelInsets, getLabelPaint, getMaxTickLabelWidth, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, getTicks, isTickLabelsVisible, isTickMarksVisible, isVisible, notifyListeners, 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_VERTICAL_LABEL

public static final boolean DEFAULT_VERTICAL_LABEL
The default setting for vertical axis label.

See Also:
Constant Field Values
Constructor Detail

VerticalCategoryAxis

public VerticalCategoryAxis(java.lang.String label)
Constructs a new axis, using default attributes where necessary.

Parameters:
label - the axis label (null permitted).
Method Detail

isVerticalLabel

public boolean isVerticalLabel()
Returns a flag indicating whether or not the axis label is drawn vertically.

Returns:
The flag.

setVerticalLabel

public void setVerticalLabel(boolean flag)
Sets a flag indicating whether or not the axis label is drawn vertically. If the setting is changed, registered listeners are notified that the axis has changed.

Parameters:
flag - the flag.

getCategoryStart

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

Specified by:
getCategoryStart in class CategoryAxis
Parameters:
category - the category.
categoryCount - the number of categories.
area - the data area.
Returns:
the coordinate.

getCategoryMiddle

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

Specified by:
getCategoryMiddle in class CategoryAxis
Parameters:
category - the category.
categoryCount - the number of categories.
area - the data area.
Returns:
the coordinate.

getCategoryEnd

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

Specified by:
getCategoryEnd in class CategoryAxis
Parameters:
category - the category.
categoryCount - the number of categories.
area - the data area.
Returns:
the coordinate.

draw

public void draw(java.awt.Graphics2D g2,
                 java.awt.geom.Rectangle2D plotArea,
                 java.awt.geom.Rectangle2D dataArea,
                 int location)
Draws the axis on a Java 2D graphics device (such as the screen or a printer).

Specified by:
draw in class Axis
Parameters:
g2 - the graphics device.
plotArea - the area within which the axis should be drawn.
dataArea - the area within which the plot is being drawn.
location - the location of the axis (LEFT or RIGHT).

refreshTicks

public void refreshTicks(java.awt.Graphics2D g2,
                         java.awt.geom.Rectangle2D drawArea,
                         java.awt.geom.Rectangle2D plotArea,
                         int location)
Creates a temporary list of ticks that can be used when drawing the axis.

Specified by:
refreshTicks in class Axis
Parameters:
g2 - the graphics device (used to get font measurements).
drawArea - the area where the plot and axes will be drawn.
plotArea - the area inside the axes.
location - the location of the axis.

reserveWidth

public double reserveWidth(java.awt.Graphics2D g2,
                           Plot plot,
                           java.awt.geom.Rectangle2D drawArea,
                           int location)
Estimates the height required for the axis, given a specific drawing area, without any information about the width of the vertical axis.

Supports the VerticalAxis interface.

Specified by:
reserveWidth in interface VerticalAxis
Parameters:
g2 - the graphics device (used to obtain font information).
drawArea - the area within which the axis should be drawn.
plot - the plot that the axis belongs to.
location - the axis location.
Returns:
the estimated height required for the axis.

reserveWidth

public double reserveWidth(java.awt.Graphics2D g2,
                           Plot plot,
                           java.awt.geom.Rectangle2D drawArea,
                           int location,
                           double reservedHeight,
                           int horizontalAxisLocation)
Returns the area required to draw the axis in the specified draw area.

Specified by:
reserveWidth in interface VerticalAxis
Parameters:
g2 - the graphics device.
plot - the plot that the axis belongs to.
drawArea - the area within which the plot should be drawn.
location - the axis location.
reservedHeight - the height reserved by the horizontal axis.
horizontalAxisLocation - the horizontal axis location.
Returns:
the area to reserve for the axis.

isCompatiblePlot

protected boolean isCompatiblePlot(Plot plot)
Returns true if the specified plot is compatible with the axis, and false otherwise.

Specified by:
isCompatiblePlot in class Axis
Parameters:
plot - the plot.
Returns:
a boolean indicating whether or not the axis considers the plot is compatible.

configure

public void configure()
Configures the axis against the current plot. Nothing required in this class.

Specified by:
configure in class Axis