org.jfree.chart.plot
Class HorizontalCategoryPlot

java.lang.Object
  |
  +--org.jfree.chart.plot.Plot
        |
        +--org.jfree.chart.plot.CategoryPlot
              |
              +--org.jfree.chart.plot.HorizontalCategoryPlot
All Implemented Interfaces:
AxisChangeListener, AxisConstants, CategoryPlotConstants, DatasetChangeListener, java.util.EventListener, HorizontalValuePlot, java.io.Serializable

public class HorizontalCategoryPlot
extends CategoryPlot
implements HorizontalValuePlot, 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 horizontal axis and the categories are plotted along the vertical axis. The VerticalCategoryPlot 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
HorizontalCategoryPlot(CategoryDataset data, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryItemRenderer renderer)
          Constructs a horizontal category plot.
 
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).
 Range getHorizontalDataRange(ValueAxis axis)
          Returns the range of data values that will be plotted against the range axis.
 ValueAxis getHorizontalValueAxis()
          Returns the horizontal axis.
 java.lang.String getPlotType()
          Returns a short string describing the type of plot.
 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 data in the secondary dataset (if there is one) 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

HorizontalCategoryPlot

public HorizontalCategoryPlot(CategoryDataset data,
                              CategoryAxis domainAxis,
                              ValueAxis rangeAxis,
                              CategoryItemRenderer renderer)
Constructs a horizontal category plot.

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

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 proposed 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.

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 data in the secondary dataset (if there is one) 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:
plot type description.

getHorizontalDataRange

public Range getHorizontalDataRange(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:
getHorizontalDataRange in interface HorizontalValuePlot
Parameters:
axis - the axis.
Returns:
the range.

getHorizontalValueAxis

public ValueAxis getHorizontalValueAxis()
Returns the horizontal axis.

This method supports the HorizontalValuePlot interface.

Specified by:
getHorizontalValueAxis in interface HorizontalValuePlot
Returns:
the horizontal axis.

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 - x-coordinate of the click.
y - y-coordinate of the click.
info - an optional info collection object to return data back to the caller.