org.jfree.chart.plot
Class OverlaidVerticalCategoryPlot

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

public class OverlaidVerticalCategoryPlot
extends VerticalCategoryPlot
implements java.io.Serializable

An extension of VerticalCategoryPlot that allows multiple plots to be overlaid in one space, using common axes.

The code assumes that all the subplots use datasets with the SAME categories.

Author:
Jeremy Bowman
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
OverlaidVerticalCategoryPlot(CategoryAxis domain, ValueAxis range)
          Constructs a new overlaid vertical category plot.
OverlaidVerticalCategoryPlot(java.lang.String domainAxisLabel, java.lang.String rangeAxisLabel)
          Constructs a new overlaid vertical category plot.
 
Method Summary
 void add(VerticalCategoryPlot subplot)
          Adds a subplot.
 CategoryDataset getCategoryDataset()
          Returns the category dataset for the plot.
 LegendItemCollection getLegendItems()
          Returns the legend items.
 java.lang.String getPlotType()
          Returns a string for the plot type.
 Range getVerticalDataRange(ValueAxis axis)
          Returns the range of data values that will be plotted against the range axis.
 void render(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, ChartRenderingInfo info)
          Performs the actual drawing of the data.
 
Methods inherited from class org.jfree.chart.plot.VerticalCategoryPlot
draw, getVerticalValueAxis, handleClick, isCompatibleDomainAxis, isCompatibleHorizontalAxis, isCompatibleRangeAxis, isCompatibleVerticalAxis, render2
 
Methods inherited from class org.jfree.chart.plot.CategoryPlot
addAnnotation, addRangeMarker, clearRangeMarkers, datasetChanged, getAnnotations, getDomainAxis, getDomainAxisLocation, getDomainGridlinePaint, getDomainGridlineStroke, 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

OverlaidVerticalCategoryPlot

public OverlaidVerticalCategoryPlot(java.lang.String domainAxisLabel,
                                    java.lang.String rangeAxisLabel)
Constructs a new overlaid vertical category plot.

Parameters:
domainAxisLabel - the label for the domain axis.
rangeAxisLabel - the label for the range axis.

OverlaidVerticalCategoryPlot

public OverlaidVerticalCategoryPlot(CategoryAxis domain,
                                    ValueAxis range)
Constructs a new overlaid vertical category plot.

Parameters:
domain - horizontal axis to use for all sub-plots.
range - vertical axis to use for all sub-plots.
Method Detail

add

public void add(VerticalCategoryPlot subplot)
Adds a subplot.

This method sets the axes of the subplot to null.

Parameters:
subplot - the subplot.

getCategoryDataset

public CategoryDataset getCategoryDataset()
Returns the category dataset for the plot. A trick is employed here - the overlaid plot does not have a dataset, only the subplots do. We return the dataset for the first subplot, this will only be used to get the categories for the domain axis.

Overrides:
getCategoryDataset in class CategoryPlot
Returns:
The dataset.

getLegendItems

public LegendItemCollection getLegendItems()
Returns the legend items.

Overrides:
getLegendItems in class CategoryPlot
Returns:
the legend items.

render

public void render(java.awt.Graphics2D g2,
                   java.awt.geom.Rectangle2D dataArea,
                   ChartRenderingInfo info)
Performs the actual drawing of the data.

Overrides:
render in class VerticalCategoryPlot
Parameters:
g2 - the graphics device.
dataArea - the data area.
info - the chart rendering info.

getPlotType

public java.lang.String getPlotType()
Returns a string for the plot type.

Overrides:
getPlotType in class VerticalCategoryPlot
Returns:
a string for the plot type.

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
Overrides:
getVerticalDataRange in class VerticalCategoryPlot
Parameters:
axis - the axis.
Returns:
The data range.