com.jrefinery.chart
Class OverlaidXYPlot

java.lang.Object
  |
  +--com.jrefinery.chart.Plot
        |
        +--com.jrefinery.chart.XYPlot
              |
              +--com.jrefinery.chart.OverlaidXYPlot
All Implemented Interfaces:
AxisChangeListener, AxisConstants, DatasetChangeListener, java.util.EventListener, HorizontalValuePlot, java.beans.PropertyChangeListener, VerticalValuePlot

public class OverlaidXYPlot
extends XYPlot

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

Author:
Bill Kelemen (bill@kelemen-usa.com)

Fields inherited from class com.jrefinery.chart.Plot
backgroundAlpha, backgroundImage, backgroundPaint, dataset, DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, foregroundAlpha, insets, listenerList, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, noDataMessage, noDataMessageFont, outlinePaint, outlineStroke, seriesOutlinePaint, seriesOutlineStroke, seriesPaint, seriesStroke, shapeFactory, ZERO
 
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_PAINT, DEFAULT_TICK_STROKE
 
Constructor Summary
OverlaidXYPlot(java.lang.String domainAxisLabel, java.lang.String rangeAxisLabel)
          Constructs a new overlaid XY plot.
OverlaidXYPlot(ValueAxis domain, ValueAxis range)
          Constructs an OverlaidXYPlot.
 
Method Summary
 void add(XYPlot subplot)
          Adds a subplot.
 Range getHorizontalDataRange()
          Returns the horizontal (x-axis) data range.
 java.util.List getLegendItemLabels()
          Deprecated. use getLegendItems.
 LegendItemCollection getLegendItems()
          Returns a collection of legend items for the overlaid plot.
 java.lang.String getPlotType()
          Returns a string representing the plot type.
 int getSeriesCount()
          Returns the number of series in this plot.
 Range getVerticalDataRange()
          Returns the vertical (y-axis) data range.
 void render(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, ChartRenderingInfo info, CrosshairInfo crosshairInfo)
          Renders the subplots.
 
Methods inherited from class com.jrefinery.chart.XYPlot
addAnnotation, addDomainMarker, addHorizontalLine, addHorizontalLine, addRangeMarker, addVerticalLine, addVerticalLine, clearAnnotations, clearDomainMarkers, clearRangeMarkers, datasetChanged, draw, drawHorizontalLine, drawVerticalLine, getDomainAxis, getHorizontalAxis, getHorizontalValueAxis, getItemRenderer, getParent, getRangeAxis, getRenderer, getVerticalAxis, getVerticalValueAxis, getWeight, getXYDataset, handleClick, isCompatibleDomainAxis, isCompatibleRangeAxis, isSubplot, propertyChange, setDomainAxis, setParent, setRangeAxis, setRenderer, setWeight, setXYItemRenderer, zoom
 
Methods inherited from class com.jrefinery.chart.Plot
addChangeListener, axisChanged, drawNoDataMessage, drawOutlineAndBackground, getBackgroundAlpha, getBackgroundPaint, getDataset, getDatasetGroup, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getOutlinePaint, getOutlineStroke, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesStroke, getShape, getShape, getShapeFactory, notifyListeners, removeChangeListener, setBackgroundAlpha, setBackgroundImage, setBackgroundPaint, setDataset, setDatasetGroup, setForegroundAlpha, setInsets, setNoDataMessage, setNoDataMessageFont, setOutlinePaint, setOutlineStroke, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesStroke, setSeriesStroke, setShapeFactory
 
Methods inherited from class java.lang.Object
clone, equals, 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 an OverlaidXYPlot.
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.

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()
Returns the horizontal (x-axis) data range. This is the combined range of all the subplots.
Overrides:
getHorizontalDataRange in class XYPlot
Returns:
the horizontal data range.

getVerticalDataRange

public Range getVerticalDataRange()
Returns the vertical (y-axis) data range. This is the combined range of all the subplots.
Overrides:
getVerticalDataRange in class XYPlot
Returns:
the vertical data range.

getSeriesCount

public int getSeriesCount()
Returns the number of series in this plot. In this case, this is the sum of the number of series in all the subplots.
Overrides:
getSeriesCount in class XYPlot
Returns:
The series count.

getLegendItemLabels

public java.util.List getLegendItemLabels()
Deprecated. use getLegendItems.

Returns an array of labels to be displayed by the legend.
Overrides:
getLegendItemLabels in class XYPlot
Returns:
an array of legend item labels (or null).