org.jfree.chart.plot
Class VerticalCategoryPlot

java.lang.Object
  |
  +--org.jfree.chart.plot.Plot
        |
        +--org.jfree.chart.plot.CategoryPlot
              |
              +--org.jfree.chart.plot.VerticalCategoryPlot
All Implemented Interfaces:
AxisChangeListener, AxisConstants, CategoryPlotConstants, DatasetChangeListener, java.util.EventListener, java.io.Serializable, VerticalValuePlot
Direct Known Subclasses:
OverlaidVerticalCategoryPlot

public class VerticalCategoryPlot
extends CategoryPlot
implements VerticalValuePlot, java.io.Serializable

A general plotting class that uses data from a CategoryDataset and renders each data item using a CategoryItemRenderer. In this plot, the values are plotted along the vertical axis and the categories are plotted along the horizontal axis. The HorizontalCategoryPlot provides the reverse orientation.

Author:
David Gilbert
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jfree.chart.plot.Plot
DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO
 
Fields inherited from interface org.jfree.chart.plot.CategoryPlotConstants
DEFAULT_DOMAIN_GRIDLINES_VISIBLE, DEFAULT_GRIDLINE_PAINT, DEFAULT_GRIDLINE_STROKE, DEFAULT_RANGE_GRIDLINES_VISIBLE, DEFAULT_VALUE_LABEL_FONT
 
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
VerticalCategoryPlot(CategoryDataset data, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryItemRenderer renderer)
          Constructs a new vertical category plot, using default attributes where necessary.
 
Method Summary
 void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, ChartRenderingInfo info)
          Draws the plot on a Java 2D graphics device (such as the screen or a printer).
 java.lang.String getPlotType()
          Returns a short string describing the type of plot.
 Range getVerticalDataRange(ValueAxis axis)
          Returns the range of data values that will be plotted against the range axis.
 ValueAxis getVerticalValueAxis()
          Returns the vertical value axis.
 void handleClick(int x, int y, ChartRenderingInfo info)
          Handles a 'click' on the plot by updating the anchor values.
 boolean isCompatibleDomainAxis(CategoryAxis axis)
          Checks the compatibility of a domain axis, returning true if the axis is compatible with the plot, and false otherwise.
 boolean isCompatibleHorizontalAxis(Axis axis)
          Checks the compatibility of a horizontal axis, returning true if the axis is compatible with the plot, and false otherwise.
 boolean isCompatibleRangeAxis(ValueAxis axis)
          Checks the compatibility of a range axis, returning true if the axis is compatible with the plot, and false otherwise.
 boolean isCompatibleVerticalAxis(Axis axis)
          Checks the compatibility of a vertical axis, returning true if the axis is compatible with the plot, and false otherwise.
 void render(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, ChartRenderingInfo info)
          Draws a representation of the data within the dataArea region, using the current renderer.
 void render2(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, ChartRenderingInfo info)
          Draws a representation of the secondary dataset within the dataArea region, using the current renderer.
 
Methods inherited from class org.jfree.chart.plot.CategoryPlot
addAnnotation, addRangeMarker, clearRangeMarkers, datasetChanged, getAnnotations, getCategoryDataset, getDomainAxis, getDomainAxisLocation, getDomainGridlinePaint, getDomainGridlineStroke, getLegendItems, getRangeAxis, getRangeAxisLocation, getRangeCrosshairPaint, getRangeCrosshairStroke, getRangeCrosshairValue, getRangeGridlinePaint, getRangeGridlineStroke, getRangeMarkers, getRenderer, getSecondaryCategoryDataset, getSecondaryRangeAxis, getSecondaryRenderer, getValueLabelFont, getValueLabelFormatter, getValueLabelPaint, getValueLabelsVisible, getVerticalValueLabels, isDomainGridlinesVisible, isRangeCrosshairLockedOnData, isRangeCrosshairVisible, isRangeGridlinesVisible, setDomainAxis, setDomainAxisLocation, setDomainAxisLocation, setDomainGridlinePaint, setDomainGridlineStroke, setDomainGridlinesVisible, setLabelsVisible, setRangeAxis, setRangeAxisLocation, setRangeAxisLocation, setRangeCrosshairLockedOnData, setRangeCrosshairPaint, setRangeCrosshairStroke, setRangeCrosshairValue, setRangeCrosshairValue, setRangeCrosshairVisible, setRangeGridlinePaint, setRangeGridlineStroke, setRangeGridlinesVisible, setRenderer, setRenderer, setSecondaryRangeAxis, setSecondaryRenderer, setValueLabelFont, setValueLabelFormatString, setValueLabelPaint, setValueLabelsVisible, setVerticalValueLabels, zoom
 
Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, axisChanged, drawBackground, drawNoDataMessage, drawOutline, equals, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundPaint, getDataAreaRatio, getDataset, getDatasetGroup, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOppositeAxisLocation, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, getSecondaryDataset, isSubplot, notifyListeners, removeChangeListener, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundPaint, setDataAreaRatio, setDataset, setDatasetGroup, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setOutlinePaint, setOutlineStroke, setParent, setSecondaryDataset
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

VerticalCategoryPlot

public VerticalCategoryPlot(CategoryDataset data,
                            CategoryAxis domainAxis,
                            ValueAxis rangeAxis,
                            CategoryItemRenderer renderer)
Constructs a new vertical category plot, using default attributes where necessary.

Parameters:
data - the dataset.
domainAxis - the domain axis.
rangeAxis - the range axis.
renderer - the renderer for the data.
Method Detail

getVerticalValueAxis

public ValueAxis getVerticalValueAxis()
Returns the vertical value axis.

This method supports the VerticalValuePlot interface.

Specified by:
getVerticalValueAxis in interface VerticalValuePlot
Returns:
the vertical axis.

isCompatibleHorizontalAxis

public boolean isCompatibleHorizontalAxis(Axis axis)
Checks the compatibility of a horizontal axis, returning true if the axis is compatible with the plot, and false otherwise.

Parameters:
axis - the horizontal axis.
Returns:
true if the axis is compatible with the plot.

isCompatibleVerticalAxis

public boolean isCompatibleVerticalAxis(Axis axis)
Checks the compatibility of a vertical axis, returning true if the axis is compatible with the plot, and false otherwise.

To be compatible with a VerticalCategoryPlot, the axis needs to implement the VerticalAxis interface *and* be a subclass of ValueAxis.

Parameters:
axis - the vertical axis.
Returns:
true if the axis is compatible with the plot.

isCompatibleDomainAxis

public boolean isCompatibleDomainAxis(CategoryAxis axis)
Checks the compatibility of a domain axis, returning true if the axis is compatible with the plot, and false otherwise.

Specified by:
isCompatibleDomainAxis in class CategoryPlot
Parameters:
axis - the proposed axis.
Returns:
true if the axis is compatible with the plot.

isCompatibleRangeAxis

public boolean isCompatibleRangeAxis(ValueAxis axis)
Checks the compatibility of a range axis, returning true if the axis is compatible with the plot, and false otherwise.

Specified by:
isCompatibleRangeAxis in class CategoryPlot
Parameters:
axis - the proposed axis.
Returns:
true if the axis is compatible with the plot.

draw

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

At your option, you may supply an instance of ChartRenderingInfo. If you do, it will be populated with information about the drawing, including various plot dimensions and tooltip info.

Specified by:
draw in class Plot
Parameters:
g2 - the graphics device.
plotArea - the area within which the plot (including axes) should be drawn.
info - collects info as the chart is drawn.

render

public void render(java.awt.Graphics2D g2,
                   java.awt.geom.Rectangle2D dataArea,
                   ChartRenderingInfo info)
Draws a representation of the data within the dataArea region, using the current renderer.

Parameters:
g2 - the graphics device.
dataArea - the region in which the data is to be drawn.
info - an optional object for collection dimension information.

render2

public void render2(java.awt.Graphics2D g2,
                    java.awt.geom.Rectangle2D dataArea,
                    ChartRenderingInfo info)
Draws a representation of the secondary dataset within the dataArea region, using the current renderer.

Parameters:
g2 - the graphics device.
dataArea - the region in which the data is to be drawn.
info - an optional object for collection dimension information.

getPlotType

public java.lang.String getPlotType()
Returns a short string describing the type of plot.

Specified by:
getPlotType in class Plot
Returns:
a description.

getVerticalDataRange

public Range getVerticalDataRange(ValueAxis axis)
Returns the range of data values that will be plotted against the range axis.

If the dataset is null, this method returns null.

Specified by:
getVerticalDataRange in interface VerticalValuePlot
Parameters:
axis - the axis.
Returns:
The data range.

handleClick

public void handleClick(int x,
                        int y,
                        ChartRenderingInfo info)
Handles a 'click' on the plot by updating the anchor values.

Overrides:
handleClick in class Plot
Parameters:
x - the x coordinate.
y - the y coordinate.
info - the dimensions of the plot.