org.jfree.chart.plot
Class OverlaidXYPlot

java.lang.Object
  |
  +--org.jfree.chart.plot.Plot
        |
        +--org.jfree.chart.plot.XYPlot
              |
              +--org.jfree.chart.plot.OverlaidXYPlot
All Implemented Interfaces:
AxisChangeListener, AxisConstants, DatasetChangeListener, java.util.EventListener, HorizontalValuePlot, java.beans.PropertyChangeListener, java.io.Serializable, VerticalValuePlot

public class OverlaidXYPlot
extends XYPlot
implements java.io.Serializable

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

Author:
Bill Kelemen (bill@kelemen-usa.com)
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jfree.chart.plot.XYPlot
DEFAULT_CROSSHAIR_PAINT, DEFAULT_CROSSHAIR_STROKE, DEFAULT_CROSSHAIR_VISIBLE, DEFAULT_GRIDLINE_PAINT, DEFAULT_GRIDLINE_STROKE
 
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.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
OverlaidXYPlot(java.lang.String domainAxisLabel, java.lang.String rangeAxisLabel)
          Constructs a new overlaid XY plot.
OverlaidXYPlot(ValueAxis domain, ValueAxis range)
          Constructs a new overlaid plot (with no subplots initially).
 
Method Summary
 void add(XYPlot subplot)
          Adds a subplot.
 Range getHorizontalDataRange(ValueAxis axis)
          Returns the horizontal (x-axis) data range.
 LegendItemCollection getLegendItems()
          Returns a collection of legend items for the overlaid plot.
 java.lang.String getPlotType()
          Returns a string representing the plot type.
 Range getVerticalDataRange(ValueAxis axis)
          Returns the vertical (y-axis) data range.
 void remove(XYPlot subplot)
          Removes a subplot from the overlaid chart.
 void render(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, ChartRenderingInfo info, CrosshairInfo crosshairInfo)
          Renders the subplots.
 
Methods inherited from class org.jfree.chart.plot.XYPlot
addAnnotation, addDomainMarker, addRangeMarker, addSecondaryRangeMarker, clearAnnotations, clearDomainMarkers, clearRangeMarkers, clearSecondaryRangeMarkers, datasetChanged, draw, drawHorizontalLine, drawVerticalLine, equals, getDomainAxis, getDomainAxisLocation, getDomainCrosshairPaint, getDomainCrosshairStroke, getDomainCrosshairValue, getDomainGridlinePaint, getDomainGridlineStroke, getHorizontalAxis, getHorizontalValueAxis, getRangeAxis, getRangeAxisLocation, getRangeCrosshairPaint, getRangeCrosshairStroke, getRangeCrosshairValue, getRangeGridlinePaint, getRangeGridlineStroke, getRenderer, getSecondaryRangeAxis, getSecondaryRenderer, getSecondaryXYDataset, getSeriesCount, getVerticalAxis, getVerticalValueAxis, getWeight, getXYDataset, handleClick, isCompatibleDomainAxis, isCompatibleRangeAxis, isDomainCrosshairLockedOnData, isDomainCrosshairVisible, isDomainGridlinesVisible, isRangeCrosshairLockedOnData, isRangeCrosshairVisible, isRangeGridlinesVisible, propertyChange, render2, setDomainAxis, setDomainAxisLocation, setDomainAxisLocation, setDomainCrosshairLockedOnData, setDomainCrosshairPaint, setDomainCrosshairStroke, setDomainCrosshairValue, setDomainCrosshairValue, setDomainCrosshairVisible, setDomainGridlinePaint, setDomainGridlineStroke, setDomainGridlinesVisible, setRangeAxis, setRangeAxisLocation, setRangeAxisLocation, setRangeCrosshairLockedOnData, setRangeCrosshairPaint, setRangeCrosshairStroke, setRangeCrosshairValue, setRangeCrosshairValue, setRangeCrosshairVisible, setRangeGridlinePaint, setRangeGridlineStroke, setRangeGridlinesVisible, setRenderer, setSecondaryRangeAxis, setSecondaryRenderer, setWeight, zoom
 
Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, axisChanged, drawBackground, drawNoDataMessage, drawOutline, 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

OverlaidXYPlot

public OverlaidXYPlot(java.lang.String domainAxisLabel,
                      java.lang.String rangeAxisLabel)
Constructs a new overlaid XY plot. Number axes are created for the X and Y axes, using the supplied labels.

After creating a new OverlaidXYPlot, you need to add some subplots.

No dataset is required, because each of the subplots maintains its own dataset.

This constructor is provided for convenience. If you need greater control over the axes, use another constructor.

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

OverlaidXYPlot

public OverlaidXYPlot(ValueAxis domain,
                      ValueAxis range)
Constructs a new overlaid plot (with no subplots initially).

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(XYPlot subplot)
Adds a subplot.

This method sets the axes of the subplot to null since the subplot will use the axes from this (parent) plot.

Parameters:
subplot - the subplot.

remove

public void remove(XYPlot subplot)
Removes a subplot from the overlaid chart.

Parameters:
subplot - the subplot.

getLegendItems

public LegendItemCollection getLegendItems()
Returns a collection of legend items for the overlaid plot.

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

render

public void render(java.awt.Graphics2D g2,
                   java.awt.geom.Rectangle2D dataArea,
                   ChartRenderingInfo info,
                   CrosshairInfo crosshairInfo)
Renders the subplots.

The draw(...) method inherited from XYPlot takes care of all the setup (background and axes) then calls the render(...) method.

Overrides:
render in class XYPlot
Parameters:
g2 - the graphics device.
dataArea - the area inside the axes.
info - optional information collection.
crosshairInfo - collects information about crosshairs.

getPlotType

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

Overrides:
getPlotType in class XYPlot
Returns:
the plot type.

getHorizontalDataRange

public Range getHorizontalDataRange(ValueAxis axis)
Returns the horizontal (x-axis) data range. This is the combined range of all the subplots.

Specified by:
getHorizontalDataRange in interface HorizontalValuePlot
Overrides:
getHorizontalDataRange in class XYPlot
Parameters:
axis - the axis.
Returns:
the horizontal data range.

getVerticalDataRange

public Range getVerticalDataRange(ValueAxis axis)
Returns the vertical (y-axis) data range. This is the combined range of all the subplots.

Specified by:
getVerticalDataRange in interface VerticalValuePlot
Overrides:
getVerticalDataRange in class XYPlot
Parameters:
axis - the axis.
Returns:
the vertical data range.