com.jrefinery.chart
Interface CategoryItemRenderer

All Known Implementing Classes:
AbstractCategoryItemRenderer, HorizontalBarRenderer, HorizontalIntervalBarRenderer, VerticalBarRenderer, VerticalStatisticalBarRenderer, VerticalIntervalBarRenderer

public interface CategoryItemRenderer

Defines the interface for a category item renderer.

Author:
DG

Method Summary
 void drawCategoryItem(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, CategoryPlot plot, ValueAxis axis, CategoryDataset data, int series, java.lang.Object category, int categoryIndex, java.lang.Object previousCategory)
          Draws a single data item.
 void drawPlotBackground(java.awt.Graphics2D g2, CategoryPlot plot, java.awt.geom.Rectangle2D axisDataArea, java.awt.Shape dataClipArea)
          Draws the background for the plot.
 void drawRangeMarker(java.awt.Graphics2D g2, CategoryPlot plot, ValueAxis axis, Marker marker, java.awt.geom.Rectangle2D axisDataArea, java.awt.Shape dataClipRegion)
          Draws a line (or some other marker) to indicate a particular value on the range axis.
 java.awt.geom.Rectangle2D getAxisArea(java.awt.geom.Rectangle2D plotArea)
          Returns the area that the axes must fit into.
 java.awt.Shape getDataClipRegion(java.awt.geom.Rectangle2D dataArea)
          Returns the clip region...
 LegendItem getLegendItem(int series)
          Returns a legend item for a series.
 CategoryPlot getPlot()
          Returns the plot that the renderer has been assigned to.
 void initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, CategoryPlot plot, ValueAxis axis, CategoryDataset data, ChartRenderingInfo info)
          Initialises the renderer.
 boolean isStacked()
          Returns true if the data values are stacked, and false otherwise.
 void setPlot(CategoryPlot plot)
          Sets the plot that the renderer has been assigned to.
 

Method Detail

initialise

public void initialise(java.awt.Graphics2D g2,
                       java.awt.geom.Rectangle2D dataArea,
                       CategoryPlot plot,
                       ValueAxis axis,
                       CategoryDataset data,
                       ChartRenderingInfo 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.
Parameters:
g2 - the graphics device.
dataArea - the area inside the axes.
plot - the plot.
axis - the range axis.
data - the data.
info - collects chart rendering information for return to caller.

isStacked

public boolean isStacked()
Returns true if the data values are stacked, and false otherwise.

If the data values are stacked, this affects the axis range required to display all the data items.

Returns:
a flag indicating whether or not the data values are stacked.

getAxisArea

public java.awt.geom.Rectangle2D getAxisArea(java.awt.geom.Rectangle2D plotArea)
Returns the area that the axes 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).
Parameters:
plotArea - the data plot area.
Returns:
the area that the axes must fit into.

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.
Parameters:
dataArea - the area inside the axes.
Returns:
the clip region.

drawPlotBackground

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

For most charts, the axisDataArea and the dataClipArea are the same. One case where they are different is the 3D-effect bar charts... here the data clip area extends above and to the right of the axisDataArea.

Parameters:
g2 - the graphics device.
plot - the plot.
axisDataArea - the area inside the axes.
dataClipArea - the data clip area.

drawRangeMarker

public void drawRangeMarker(java.awt.Graphics2D g2,
                            CategoryPlot plot,
                            ValueAxis axis,
                            Marker marker,
                            java.awt.geom.Rectangle2D axisDataArea,
                            java.awt.Shape dataClipRegion)
Draws a line (or some other marker) to indicate a particular value on the range axis.
Parameters:
g2 - the graphics device.
plot - the plot.
axis - the value axis.
marker - the marker.
axisDataArea - the area defined by the axes.
dataClipRegion - the data clip region.

drawCategoryItem

public void drawCategoryItem(java.awt.Graphics2D g2,
                             java.awt.geom.Rectangle2D dataArea,
                             CategoryPlot plot,
                             ValueAxis axis,
                             CategoryDataset data,
                             int series,
                             java.lang.Object category,
                             int categoryIndex,
                             java.lang.Object previousCategory)
Draws a single data item.
Parameters:
g2 - the graphics device.
dataArea - the data plot area.
plot - the plot.
axis - the range axis.
data - the data.
series - the series number (zero-based index).
category - the category.
categoryIndex - the category number (zero-based index).
previousCategory - the previous category (null when the first category is drawn).

getLegendItem

public LegendItem getLegendItem(int series)
Returns a legend item for a series.
Parameters:
series - the series (zero-based index).
Returns:
the legend item.

getPlot

public CategoryPlot getPlot()
Returns the plot that the renderer has been assigned to.
Returns:
the plot.

setPlot

public void setPlot(CategoryPlot plot)
Sets the plot that the renderer has been assigned to.

You shouldn't need to call this method yourself, the Plot class will do it for you.

Parameters:
plot - the plot.