com.jrefinery.chart
Class VerticalCategoryAxis

java.lang.Object
  extended by com.jrefinery.chart.Axis
      extended by com.jrefinery.chart.CategoryAxis
          extended by com.jrefinery.chart.VerticalCategoryAxis
All Implemented Interfaces:
AxisConstants, VerticalAxis

public class VerticalCategoryAxis
extends CategoryAxis
implements VerticalAxis

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

The axis needs to rely on the plot for placement of labels, since the plot controls how the categories are distributed.


Field Summary
static boolean DEFAULT_VERTICAL_LABEL
          The default setting for vertical axis label.
protected  boolean verticalLabel
          A flag that indicates whether or not the axis label should be drawn vertically.
 
Fields inherited from class com.jrefinery.chart.Axis
fixedDimension, label, labelFont, labelInsets, labelPaint, listeners, plot, tickLabelFont, tickLabelInsets, tickLabelPaint, tickLabelsVisible, tickMarkStroke, tickMarksVisible, ticks, visible
 
Fields inherited from interface com.jrefinery.chart.AxisConstants
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_STROKE
 
Constructor Summary
VerticalCategoryAxis(java.lang.String label)
          Constructs a new axis, using default attributes where necessary.
VerticalCategoryAxis(java.lang.String label, java.awt.Font labelFont, java.awt.Paint labelPaint, java.awt.Insets labelInsets, boolean verticalLabel, boolean categoryLabelsVisible, java.awt.Font categoryLabelFont, java.awt.Paint categoryLabelPaint, java.awt.Insets categoryLabelInsets, boolean tickMarksVisible, java.awt.Stroke tickMarkStroke)
          Constructs a new axis.
 
Method Summary
 void configure()
          Configures the axis against the current plot.
 void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D drawArea, java.awt.geom.Rectangle2D plotArea)
          Draws the CategoryAxis on a Java 2D graphics device (such as the screen or a printer).
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)
          Creates a temporary list of ticks that can be used when drawing the axis.
 java.awt.geom.Rectangle2D reserveAxisArea(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D drawArea, double reservedHeight)
          Returns the area required to draw the axis in the specified draw area.
 double reserveWidth(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D drawArea)
          Estimates the height required for the axis, given a specific drawing area, without any information about the width of the vertical axis.
 void setVerticalLabel(boolean flag)
          Sets a flag indicating whether or not the axis label is drawn vertically.
 
Methods inherited from class com.jrefinery.chart.Axis
addChangeListener, getFixedDimension, getLabel, getLabelFont, getLabelInsets, getLabelPaint, getMaxTickLabelWidth, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkStroke, isTickLabelsVisible, isTickMarksVisible, isVisible, notifyListeners, removeChangeListener, setFixedDimension, setLabel, setLabelFont, setLabelInsets, setLabelPaint, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkStroke, setTickMarksVisible, setVisible
 
Methods inherited from class java.lang.Object
clone, equals, 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

verticalLabel

protected boolean verticalLabel
A flag that indicates whether or not the axis label should be drawn vertically.

Constructor Detail

VerticalCategoryAxis

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

Parameters:
label - The axis label.

VerticalCategoryAxis

public VerticalCategoryAxis(java.lang.String label,
                            java.awt.Font labelFont,
                            java.awt.Paint labelPaint,
                            java.awt.Insets labelInsets,
                            boolean verticalLabel,
                            boolean categoryLabelsVisible,
                            java.awt.Font categoryLabelFont,
                            java.awt.Paint categoryLabelPaint,
                            java.awt.Insets categoryLabelInsets,
                            boolean tickMarksVisible,
                            java.awt.Stroke tickMarkStroke)
Constructs a new axis.

Parameters:
label - The axis label.
labelFont - The font for displaying the axis label.
labelPaint - The paint used to draw the axis label.
labelInsets - Determines the amount of blank space around the label.
verticalLabel - Flag indicating whether or not the axis label is drawn vertically.
categoryLabelsVisible - Flag indicating whether or not category labels are visible.
categoryLabelFont - The font used to display category labels.
categoryLabelPaint - The paint used to draw category labels.
tickMarksVisible - Flag indicating whether or not tick marks are visible.
tickMarkStroke - The stroke used to draw tick marks (if visible).
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:
The - flag.

draw

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

Specified by:
draw in class Axis
Parameters:
g2 - The graphics device.
drawArea - The area within which the axis should be drawn.
plotArea - The area within which the plot is being drawn.

refreshTicks

public void refreshTicks(java.awt.Graphics2D g2,
                         java.awt.geom.Rectangle2D drawArea,
                         java.awt.geom.Rectangle2D plotArea)
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.

reserveWidth

public double reserveWidth(java.awt.Graphics2D g2,
                           Plot plot,
                           java.awt.geom.Rectangle2D drawArea)
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.

reserveAxisArea

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

Specified by:
reserveAxisArea in interface VerticalAxis
Parameters:
g2 - The graphics device.
drawArea - The area within which the plot should be drawn.
reservedHeight - The height reserved by the horizontal axis.
plot - The plot that the axis belongs to.
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


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.