com.jrefinery.chart
Class AbstractCategoryItemRenderer

java.lang.Object
  extended by com.jrefinery.chart.AbstractCategoryItemRenderer
All Implemented Interfaces:
CategoryItemRenderer
Direct Known Subclasses:
AreaCategoryItemRenderer, BarRenderer, LineAndShapeRenderer

public abstract class AbstractCategoryItemRenderer
extends java.lang.Object
implements CategoryItemRenderer

Abstract base class for category item renderers.


Field Summary
protected  ChartRenderingInfo info
          Local copy of the info reference.
protected  com.jrefinery.chart.tooltips.CategoryToolTipGenerator toolTipGenerator
          The tooltip generator.
 
Constructor Summary
protected AbstractCategoryItemRenderer()
          Default constructor, creates a renderer with a standard tool tip generator.
protected AbstractCategoryItemRenderer(com.jrefinery.chart.tooltips.CategoryToolTipGenerator toolTipGenerator)
          Constructs a new renderer with the specified tooltip generator.
 
Method Summary
 void drawPlotBackground(java.awt.Graphics2D g2, CategoryPlot plot, java.awt.geom.Rectangle2D axisDataArea, java.awt.Shape dataClipRegion)
          Draws the background for the plot.
 java.awt.geom.Rectangle2D getAxisArea(java.awt.geom.Rectangle2D plotArea)
          Returns the area that the axes (and date) must fit into.
 java.awt.Shape getDataClipRegion(java.awt.geom.Rectangle2D dataArea)
          Returns the clip region...usually returns the dataArea, but some charts (e.g.
 com.jrefinery.chart.tooltips.CategoryToolTipGenerator getToolTipGenerator()
          Returns the tool tip generator.
 void initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, CategoryPlot plot, CategoryDataset data, ChartRenderingInfo info)
          Initialises the renderer.
 boolean isStacked()
          Returns a flag indicating whether the items within one category are stacked up when represented by the renderer.
 void setToolTipGenerator(com.jrefinery.chart.tooltips.CategoryToolTipGenerator toolTipGenerator)
          Sets the tool tip generator.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.jrefinery.chart.CategoryItemRenderer
drawCategoryItem, drawRangeMarker
 

Field Detail

info

protected ChartRenderingInfo info
Local copy of the info reference.


toolTipGenerator

protected com.jrefinery.chart.tooltips.CategoryToolTipGenerator toolTipGenerator
The tooltip generator.

Constructor Detail

AbstractCategoryItemRenderer

protected AbstractCategoryItemRenderer()
Default constructor, creates a renderer with a standard tool tip generator.


AbstractCategoryItemRenderer

protected AbstractCategoryItemRenderer(com.jrefinery.chart.tooltips.CategoryToolTipGenerator toolTipGenerator)
Constructs a new renderer with the specified tooltip generator.

Parameters:
toolTipGenerator - The tool tip generator.
Method Detail

getToolTipGenerator

public com.jrefinery.chart.tooltips.CategoryToolTipGenerator getToolTipGenerator()
Returns the tool tip generator.

Returns:
The tool tip generator.

setToolTipGenerator

public void setToolTipGenerator(com.jrefinery.chart.tooltips.CategoryToolTipGenerator toolTipGenerator)
Sets the tool tip generator.

Parameters:
toolTipGenerator - The tool tip generator.

initialise

public void initialise(java.awt.Graphics2D g2,
                       java.awt.geom.Rectangle2D dataArea,
                       CategoryPlot plot,
                       CategoryDataset data,
                       ChartRenderingInfo info)
Initialises the renderer.

This method gets called once each time the chart is drawn, and provides the renderer an opportunity to initialise itself. The default implementation just stores a reference to the ChartRenderingInfo object (which might be null).

Specified by:
initialise in interface CategoryItemRenderer
Parameters:
g2 - The graphics device.
dataArea - The data area.
plot - The plot.
data - The data.
info - An object for returning information about the structure of the chart.

isStacked

public boolean isStacked()
Returns a flag indicating whether the items within one category are stacked up when represented by the renderer.

Specified by:
isStacked in interface CategoryItemRenderer
Returns:
The flag.

getAxisArea

public java.awt.geom.Rectangle2D getAxisArea(java.awt.geom.Rectangle2D plotArea)
Returns the area that the axes (and date) must fit into.

Often this is the same as the plotArea, but sometimes a smaller region should be used (for example, the 3D charts require the axes to use less space in order to leave room for the 'depth' part of the chart).

Specified by:
getAxisArea in interface CategoryItemRenderer
Parameters:
plotArea - The plot area.

getDataClipRegion

public java.awt.Shape getDataClipRegion(java.awt.geom.Rectangle2D dataArea)
Returns the clip region...usually returns the dataArea, but some charts (e.g. 3D) have non rectangular clip regions.

Specified by:
getDataClipRegion in interface CategoryItemRenderer
Parameters:
dataArea - The data area.

drawPlotBackground

public void drawPlotBackground(java.awt.Graphics2D g2,
                               CategoryPlot plot,
                               java.awt.geom.Rectangle2D axisDataArea,
                               java.awt.Shape dataClipRegion)
Draws the background for the plot.

For most charts, the axisDataArea and the dataClipArea are the same.

Specified by:
drawPlotBackground in interface CategoryItemRenderer
Parameters:
g2 - The graphics device.
plot - The plot.
axisDataArea - The area inside the axes.
dataClipArea - The data clip area.


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.