com.jrefinery.chart
Class OverlaidXYPlot

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

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)

Field Summary
protected  int seriesCount
          The total number of series.
protected  java.util.List subplots
          Storage for the subplot references.
 
Fields inherited from class com.jrefinery.chart.XYPlot
domainAxis, horizontalColors, horizontalLines, parent, rangeAxis, renderer, verticalColors, verticalLines, weight
 
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, firstSeriesIndex, foregroundAlpha, insets, listeners, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, 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_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()
          Returns an array of labels to be displayed by the legend.
 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.
 void setFirstSeriesIndex(int index)
          Sets the first series index.
 
Methods inherited from class com.jrefinery.chart.XYPlot
addHorizontalLine, addHorizontalLine, addVerticalLine, addVerticalLine, datasetChanged, draw, draw, draw, drawHorizontalLine, drawHorizontalLines, drawVerticalLine, drawVerticalLines, getDomainAxis, getHorizontalAxis, getHorizontalValueAxis, getItemRenderer, getParent, getRangeAxis, getVerticalAxis, getVerticalValueAxis, getWeight, getXYDataset, handleClick, handleClick, isCompatibleDomainAxis, isCompatibleRangeAxis, isSubplot, propertyChange, setDomainAxis, setParent, setRangeAxis, setWeight, setXYItemRenderer, zoom
 
Methods inherited from class com.jrefinery.chart.Plot
addChangeListener, axisChanged, drawOutlineAndBackground, getBackgroundAlpha, getBackgroundPaint, getDataset, getFirstSeriesIndex, getForegroundAlpha, getInsets, getOutlinePaint, getOutlineStroke, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesStroke, getShape, getShape, getShapeFactory, notifyListeners, removeChangeListener, setBackgroundAlpha, setBackgroundImage, setBackgroundPaint, setDataset, setForegroundAlpha, setInsets, 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
 

Field Detail

subplots

protected java.util.List subplots
Storage for the subplot references.


seriesCount

protected int seriesCount
The total number of series.

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.

getLegendItemLabels

public java.util.List getLegendItemLabels()
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).

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.

Specified by:
getHorizontalDataRange in interface HorizontalValuePlot
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.

Specified by:
getVerticalDataRange in interface VerticalValuePlot
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.

setFirstSeriesIndex

public void setFirstSeriesIndex(int index)
Sets the first series index. This is used to give all series in the plot (including subplots) a unique number for identification purposes. Need to find a more robust method.

Overrides:
setFirstSeriesIndex in class Plot
Parameters:
index - The index.


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.