org.jfree.chart.renderer
Class AbstractXYItemRenderer

java.lang.Object
  extended byorg.jfree.chart.renderer.AbstractRenderer
      extended byorg.jfree.chart.renderer.AbstractXYItemRenderer
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, XYItemRenderer
Direct Known Subclasses:
AreaXYRenderer, CandlestickRenderer, HighLowRenderer, SignalRenderer, StandardXYItemRenderer, WindItemRenderer, XYAreaRenderer, XYBarRenderer, XYBoxAndWhiskerRenderer, XYBubbleRenderer, XYDifferenceRenderer, XYDotRenderer, XYStepAreaRenderer, XYStepRenderer, YIntervalRenderer

public abstract class AbstractXYItemRenderer
extends AbstractRenderer
implements XYItemRenderer, java.lang.Cloneable, java.io.Serializable

A base class that can be used to create new XYItemRenderer implementations.

Author:
David Gilbert
See Also:
Serialized Form

Field Summary
 
Fields inherited from class org.jfree.chart.renderer.AbstractRenderer
DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, DEFAULT_PAINT, DEFAULT_SHAPE, DEFAULT_STROKE, DEFAULT_VALUE_LABEL_FONT, DEFAULT_VALUE_LABEL_PAINT, ZERO
 
Constructor Summary
protected AbstractXYItemRenderer()
          Default constructor.
protected AbstractXYItemRenderer(XYToolTipGenerator toolTipGenerator)
          Deprecated. Use default constructor then set tooltip generator.
protected AbstractXYItemRenderer(XYToolTipGenerator toolTipGenerator, XYURLGenerator urlGenerator)
          Deprecated. Use default constructor then set URL generator.
protected AbstractXYItemRenderer(XYURLGenerator urlGenerator)
          Deprecated. Use default constructor then set URL generator.
 
Method Summary
protected  java.lang.Object clone()
          Returns a clone of the renderer.
 void drawDomainGridLine(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double value)
          Draws a grid line against the range axis.
 void drawDomainMarker(java.awt.Graphics2D g2, XYPlot plot, ValueAxis domainAxis, Marker marker, java.awt.geom.Rectangle2D dataArea)
          Draws a vertical line on the chart to represent a 'range marker'.
 void drawRangeGridLine(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double value)
          Draws a grid line against the range axis.
 void drawRangeMarker(java.awt.Graphics2D g2, XYPlot plot, ValueAxis rangeAxis, Marker marker, java.awt.geom.Rectangle2D dataArea)
          Draws a horizontal line across the chart to represent a 'range marker'.
 boolean equals(java.lang.Object obj)
          Tests this renderer for equality with another object.
 void fillDomainGridBand(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double start, double end)
          Fills a band between two values on the axis.
 void fillRangeGridBand(java.awt.Graphics2D g2, XYPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double start, double end)
          Fills a band between two values on the range axis.
 DrawingSupplier getDrawingSupplier()
          Returns the drawing supplier from the plot.
 LegendItem getLegendItem(int datasetIndex, int series)
          Returns a legend item for a series.
 int getPassCount()
          Returns the number of passes through the data that the renderer requires in order to draw the chart.
 XYPlot getPlot()
          Returns the plot that the renderer is assigned to.
 RangeType getRangeType()
          Returns the range type for the renderer.
 XYToolTipGenerator getToolTipGenerator()
          Returns the tool tip generator.
 XYURLGenerator getURLGenerator()
          Returns the URL generator for HTML image maps.
 XYItemRendererState initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, XYPlot plot, XYDataset data, PlotRenderingInfo info)
          Initialises the renderer.
 void setPlot(XYPlot plot)
          Sets the plot that the renderer is assigned to.
 void setToolTipGenerator(XYToolTipGenerator generator)
          Sets the tool tip generator.
 void setURLGenerator(XYURLGenerator urlGenerator)
          Sets the URL generator for HTML image maps.
 
Methods inherited from class org.jfree.chart.renderer.AbstractRenderer
addChangeListener, addPropertyChangeListener, createTransformedShape, firePropertyChanged, getBaseItemLabelAnchor, getBaseItemLabelAngle, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelRotationAnchor, getBaseItemLabelsVisible, getBaseItemLabelTextAnchor, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseShape, getBaseStroke, getItemLabelAnchor, getItemLabelAngle, getItemLabelFont, getItemLabelPaint, getItemLabelRotationAnchor, getItemLabelTextAnchor, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesItemLabelAnchor, getSeriesItemLabelAngle, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesItemLabelRotationAnchor, getSeriesItemLabelTextAnchor, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, hashCode, isItemLabelVisible, isSeriesItemLabelsVisible, notifyListeners, removeChangeListener, removePropertyChangeListener, setBaseAngle, setBaseItemLabelAnchor, setBaseItemLabelFont, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelPaint, setBaseItemLabelRotationAnchor, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelTextAnchor, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlinePaint, setBaseOutlineStroke, setBaseOutlineStroke, setBasePaint, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseShape, setBaseShape, setBaseStroke, setBaseStroke, setItemLabelAnchor, setItemLabelAngle, setItemLabelFont, setItemLabelFont, setItemLabelPaint, setItemLabelPaint, setItemLabelRotationAnchor, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setItemLabelTextAnchor, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlinePaint, setOutlineStroke, setOutlineStroke, setPaint, setPaint, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesAngle, setSeriesItemLabelAnchor, setSeriesItemLabelFont, setSeriesItemLabelFont, setSeriesItemLabelPaint, setSeriesItemLabelPaint, setSeriesItemLabelRotationAnchor, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelTextAnchor, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesShape, setSeriesStroke, setSeriesStroke, setShape, setShape, setStroke, setStroke
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.chart.renderer.XYItemRenderer
addPropertyChangeListener, drawItem, getBaseStroke, getItemOutlinePaint, getItemPaint, getItemShape, getItemStroke, getSeriesOutlinePaint, getSeriesPaint, getSeriesShape, getSeriesStroke, removePropertyChangeListener, setBaseStroke, setSeriesPaint, setSeriesStroke, setStroke
 

Constructor Detail

AbstractXYItemRenderer

protected AbstractXYItemRenderer()
Default constructor.


AbstractXYItemRenderer

protected AbstractXYItemRenderer(XYToolTipGenerator toolTipGenerator)
Deprecated. Use default constructor then set tooltip generator.

Creates a renderer with the specified tooltip generator.

Storage is allocated for property change listeners.

Parameters:
toolTipGenerator - the tooltip generator (null permitted).

AbstractXYItemRenderer

protected AbstractXYItemRenderer(XYURLGenerator urlGenerator)
Deprecated. Use default constructor then set URL generator.

Creates a renderer with the specified tooltip generator.

Storage is allocated for property change listeners.

Parameters:
urlGenerator - the URL generator (null permitted).

AbstractXYItemRenderer

protected AbstractXYItemRenderer(XYToolTipGenerator toolTipGenerator,
                                 XYURLGenerator urlGenerator)
Deprecated. Use default constructor then set URL generator.

Creates a renderer with the specified tooltip generator and URL generator.

Storage is allocated for property change listeners.

Parameters:
toolTipGenerator - the tooltip generator (null permitted).
urlGenerator - the URL generator (null permitted).
Method Detail

getPassCount

public int getPassCount()
Returns the number of passes through the data that the renderer requires in order to draw the chart. Most charts will require a single pass, but some require two passes.

Specified by:
getPassCount in interface XYItemRenderer
Returns:
The pass count.

getPlot

public XYPlot getPlot()
Returns the plot that the renderer is assigned to.

Specified by:
getPlot in interface XYItemRenderer
Returns:
The plot.

setPlot

public void setPlot(XYPlot plot)
Sets the plot that the renderer is assigned to.

Specified by:
setPlot in interface XYItemRenderer
Parameters:
plot - the plot.

initialise

public XYItemRendererState initialise(java.awt.Graphics2D g2,
                                      java.awt.geom.Rectangle2D dataArea,
                                      XYPlot plot,
                                      XYDataset data,
                                      PlotRenderingInfo info)
Initialises the renderer.

This method will be called before the first item is rendered, giving the renderer an opportunity to initialise any state information it wants to maintain. The renderer can do nothing if it chooses.

Specified by:
initialise in interface XYItemRenderer
Parameters:
g2 - the graphics device.
dataArea - the area inside the axes.
plot - the plot.
data - the data.
info - an optional info collection object to return data back to the caller.
Returns:
The number of passes required by the renderer.

getToolTipGenerator

public XYToolTipGenerator getToolTipGenerator()
Returns the tool tip generator.

Specified by:
getToolTipGenerator in interface XYItemRenderer
Returns:
the tool tip generator (possibly null).

setToolTipGenerator

public void setToolTipGenerator(XYToolTipGenerator generator)
Sets the tool tip generator.

Specified by:
setToolTipGenerator in interface XYItemRenderer
Parameters:
generator - the tool tip generator (null permitted).

getURLGenerator

public XYURLGenerator getURLGenerator()
Returns the URL generator for HTML image maps.

Specified by:
getURLGenerator in interface XYItemRenderer
Returns:
the URL generator (possibly null).

setURLGenerator

public void setURLGenerator(XYURLGenerator urlGenerator)
Sets the URL generator for HTML image maps.

Specified by:
setURLGenerator in interface XYItemRenderer
Parameters:
urlGenerator - the URL generator (null permitted).

getRangeType

public RangeType getRangeType()
Returns the range type for the renderer.

The default implementation returns STANDARD, subclasses may override this behaviour.

The XYPlot uses this information when auto-calculating the range for the axis.

Specified by:
getRangeType in interface XYItemRenderer
Returns:
the range type.

getLegendItem

public LegendItem getLegendItem(int datasetIndex,
                                int series)
Returns a legend item for a series.

Specified by:
getLegendItem in interface XYItemRenderer
Parameters:
datasetIndex - the dataset index (zero-based).
series - the series index (zero-based).
Returns:
a legend item for the series.

fillDomainGridBand

public void fillDomainGridBand(java.awt.Graphics2D g2,
                               XYPlot plot,
                               ValueAxis axis,
                               java.awt.geom.Rectangle2D dataArea,
                               double start,
                               double end)
Fills a band between two values on the axis. This can be used to color bands between the grid lines.

Specified by:
fillDomainGridBand in interface XYItemRenderer
Parameters:
g2 - the graphics device.
plot - the plot.
axis - the domain axis.
dataArea - the data area.
start - the start value.
end - the end value.

fillRangeGridBand

public void fillRangeGridBand(java.awt.Graphics2D g2,
                              XYPlot plot,
                              ValueAxis axis,
                              java.awt.geom.Rectangle2D dataArea,
                              double start,
                              double end)
Fills a band between two values on the range axis. This can be used to color bands between the grid lines.

Specified by:
fillRangeGridBand in interface XYItemRenderer
Parameters:
g2 - the graphics device.
plot - the plot.
axis - the range axis.
dataArea - the data area.
start - the start value.
end - the end value.

drawDomainGridLine

public void drawDomainGridLine(java.awt.Graphics2D g2,
                               XYPlot plot,
                               ValueAxis axis,
                               java.awt.geom.Rectangle2D dataArea,
                               double value)
Draws a grid line against the range axis.

Specified by:
drawDomainGridLine in interface XYItemRenderer
Parameters:
g2 - the graphics device.
plot - the plot.
axis - the value axis.
dataArea - the area for plotting data (not yet adjusted for any 3D effect).
value - the value at which the grid line should be drawn.

drawRangeGridLine

public void drawRangeGridLine(java.awt.Graphics2D g2,
                              XYPlot plot,
                              ValueAxis axis,
                              java.awt.geom.Rectangle2D dataArea,
                              double value)
Draws a grid line against the range axis.

Specified by:
drawRangeGridLine in interface XYItemRenderer
Parameters:
g2 - the graphics device.
plot - the plot.
axis - the value axis.
dataArea - the area for plotting data (not yet adjusted for any 3D effect).
value - the value at which the grid line should be drawn.

drawDomainMarker

public void drawDomainMarker(java.awt.Graphics2D g2,
                             XYPlot plot,
                             ValueAxis domainAxis,
                             Marker marker,
                             java.awt.geom.Rectangle2D dataArea)
Draws a vertical line on the chart to represent a 'range marker'.

Specified by:
drawDomainMarker in interface XYItemRenderer
Parameters:
g2 - the graphics device.
plot - the plot.
domainAxis - the domain axis.
marker - the marker line.
dataArea - the axis data area.

drawRangeMarker

public void drawRangeMarker(java.awt.Graphics2D g2,
                            XYPlot plot,
                            ValueAxis rangeAxis,
                            Marker marker,
                            java.awt.geom.Rectangle2D dataArea)
Draws a horizontal line across the chart to represent a 'range marker'.

Specified by:
drawRangeMarker in interface XYItemRenderer
Parameters:
g2 - the graphics device.
plot - the plot.
rangeAxis - the range axis.
marker - the marker line.
dataArea - the axis data area.

clone

protected java.lang.Object clone()
                          throws java.lang.CloneNotSupportedException
Returns a clone of the renderer.

Overrides:
clone in class AbstractRenderer
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - if the renderer does not support cloning.

equals

public boolean equals(java.lang.Object obj)
Tests this renderer for equality with another object.

Overrides:
equals in class AbstractRenderer
Parameters:
obj - the object.
Returns:
true or false.

getDrawingSupplier

public DrawingSupplier getDrawingSupplier()
Returns the drawing supplier from the plot.

Specified by:
getDrawingSupplier in class AbstractRenderer
Returns:
The drawing supplier (possibly null).