org.jfree.chart.renderer
Interface CategoryItemRenderer

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

public interface CategoryItemRenderer
extends Renderer

A plug-in object that is used by the CategoryPlot class to display individual data items from a CategoryDataset.

This interface defines the methods that must be provided by all renderers. If you are implementing a custom renderer, you should consider extending the AbstractCategoryItemRenderer class.

Author:
David Gilbert

Field Summary
static int STACKED
          A constant for the range type (STACKED).
static int STANDARD
          A constant for the range type (STANDARD).
 
Method Summary
 void drawBackground(java.awt.Graphics2D g2, CategoryPlot plot, java.awt.geom.Rectangle2D dataArea)
          Draws a background for the data area.
 void drawDomainGridline(java.awt.Graphics2D g2, CategoryPlot plot, java.awt.geom.Rectangle2D dataArea, double value)
          Draws a grid line against the domain axis.
 void drawItem(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset data, int dataset, int row, int column)
          Draws a single data item.
 void drawOutline(java.awt.Graphics2D g2, CategoryPlot plot, java.awt.geom.Rectangle2D dataArea)
          Draws an outline for the data area.
 void drawRangeGridline(java.awt.Graphics2D g2, CategoryPlot plot, ValueAxis axis, java.awt.geom.Rectangle2D dataArea, double value)
          Draws a grid line against the range axis.
 void drawRangeMarker(java.awt.Graphics2D g2, CategoryPlot plot, ValueAxis axis, Marker marker, java.awt.geom.Rectangle2D dataArea)
          Draws a line (or some other marker) to indicate a particular value on the range axis.
 java.awt.Paint getItemOutlinePaint(int dataset, int series, int item)
          Returns the outline paint for an item.
 java.awt.Paint getItemPaint(int dataset, int series, int category)
          Returns the paint used to fill an item.
 java.awt.Shape getItemShape(int dataset, int series, int item)
          Returns the shape for an item.
 java.awt.Stroke getItemStroke(int dataset, int series, int item)
          Returns the stroke for an item.
 LegendItem getLegendItem(int datasetIndex, int series)
          Returns a legend item for a series.
 int getRangeType()
          Returns the range type for the renderer.
 java.awt.Paint getSeriesOutlinePaint(int dataset, int series)
          Returns the outline paint for a series.
 java.awt.Paint getSeriesPaint(int dataset, int series)
          Returns the paint used to fill shapes for this renderer.
 java.awt.Shape getSeriesShape(int dataset, int series)
          Returns the shape for a series.
 java.awt.Stroke getSeriesStroke(int dataset, int series)
          Returns the stroke for a series.
 CategoryToolTipGenerator getToolTipGenerator()
          Returns the tool tip generator.
 void initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, CategoryPlot plot, ChartRenderingInfo info)
          Initialises the renderer.
 void setToolTipGenerator(CategoryToolTipGenerator generator)
          Sets the tool tip generator.
 
Methods inherited from interface org.jfree.chart.renderer.Renderer
getDefaultOutlinePaint, getDefaultOutlineStroke, getDefaultPaint, getDefaultShape, getDefaultStroke, getDrawingSupplier, getPlot, isOutlinePaintTableActive, isOutlineStrokeTableActive, isPaintTableActive, isShapeTableActive, isStrokeTableActive, setDefaultOutlinePaint, setDefaultOutlineStroke, setDefaultPaint, setDefaultShape, setDefaultStroke, setDrawingSupplier, setOutlinePaintTableActive, setOutlineStrokeTableActive, setPaintTableActive, setPlot, setSeriesPaint, setSeriesPaint, setSeriesStroke, setSeriesStroke, setShapeTableActive, setStrokeTableActive
 

Field Detail

STANDARD

public static final int STANDARD
A constant for the range type (STANDARD).

See Also:
Constant Field Values

STACKED

public static final int STACKED
A constant for the range type (STACKED).

See Also:
Constant Field Values
Method Detail

getRangeType

public int getRangeType()
Returns the range type for the renderer. The plot needs to know this information in order to determine an appropriate axis range (when the axis auto-range calculation is on).

Two types are recognised:

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.

getToolTipGenerator

public CategoryToolTipGenerator getToolTipGenerator()
Returns the tool tip generator.

Returns:
the tool tip generator (possibly null).

setToolTipGenerator

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

Classes that implement this interface are not required to support tool tip generation, although it is recommended. If the renderer does not support tooltips, this method should throw an UnsupportedOperationException.

Parameters:
generator - the tool tip generator (null permitted).

initialise

public void initialise(java.awt.Graphics2D g2,
                       java.awt.geom.Rectangle2D dataArea,
                       CategoryPlot plot,
                       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.
info - collects chart rendering information for return to caller.

getSeriesPaint

public java.awt.Paint getSeriesPaint(int dataset,
                                     int series)
Returns the paint used to fill shapes for this renderer.

Parameters:
dataset - the dataset (zero-based index).
series - the series (zero-based index).
Returns:
the paint.

getItemPaint

public java.awt.Paint getItemPaint(int dataset,
                                   int series,
                                   int category)
Returns the paint used to fill an item.

A plot can have more than one dataset, the dataset index indicates which one is being used.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
category - the category index (zero-based).
Returns:
The paint.

getLegendItem

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

Parameters:
datasetIndex - the dataset index (zero-based).
series - the series (zero-based index).
Returns:
the legend item.

drawBackground

public void drawBackground(java.awt.Graphics2D g2,
                           CategoryPlot plot,
                           java.awt.geom.Rectangle2D dataArea)
Draws a background for the data area.

Parameters:
g2 - the graphics device.
plot - the plot.
dataArea - the data area.

drawOutline

public void drawOutline(java.awt.Graphics2D g2,
                        CategoryPlot plot,
                        java.awt.geom.Rectangle2D dataArea)
Draws an outline for the data area.

Parameters:
g2 - the graphics device.
plot - the plot.
dataArea - the data area.

drawItem

public void drawItem(java.awt.Graphics2D g2,
                     java.awt.geom.Rectangle2D dataArea,
                     CategoryPlot plot,
                     CategoryAxis domainAxis,
                     ValueAxis rangeAxis,
                     CategoryDataset data,
                     int dataset,
                     int row,
                     int column)
Draws a single data item.

Parameters:
g2 - the graphics device.
dataArea - the data plot area.
plot - the plot.
domainAxis - the domain axis.
rangeAxis - the range axis.
data - the data.
dataset - the dataset index (zero-based).
row - the row index (zero-based).
column - the column index (zero-based).

drawDomainGridline

public void drawDomainGridline(java.awt.Graphics2D g2,
                               CategoryPlot plot,
                               java.awt.geom.Rectangle2D dataArea,
                               double value)
Draws a grid line against the domain axis.

Parameters:
g2 - the graphics device.
plot - the plot.
dataArea - the area for plotting data (not yet adjusted for any 3D effect).
value - the value.

drawRangeGridline

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

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.

drawRangeMarker

public void drawRangeMarker(java.awt.Graphics2D g2,
                            CategoryPlot plot,
                            ValueAxis axis,
                            Marker marker,
                            java.awt.geom.Rectangle2D dataArea)
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.
dataArea - the area for plotting data (not including 3D effect).

getItemOutlinePaint

public java.awt.Paint getItemOutlinePaint(int dataset,
                                          int series,
                                          int item)
Returns the outline paint for an item.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
item - the item index (zero-based).
Returns:
The paint.

getSeriesOutlinePaint

public java.awt.Paint getSeriesOutlinePaint(int dataset,
                                            int series)
Returns the outline paint for a series.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
Returns:
The paint.

getItemStroke

public java.awt.Stroke getItemStroke(int dataset,
                                     int series,
                                     int item)
Returns the stroke for an item.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
item - the item index (zero-based).
Returns:
The stroke.

getSeriesStroke

public java.awt.Stroke getSeriesStroke(int dataset,
                                       int series)
Returns the stroke for a series.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
Returns:
The stroke.

getItemShape

public java.awt.Shape getItemShape(int dataset,
                                   int series,
                                   int item)
Returns the shape for an item.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
item - the item index (zero-based).
Returns:
The shape.

getSeriesShape

public java.awt.Shape getSeriesShape(int dataset,
                                     int series)
Returns the shape for a series.

Parameters:
dataset - the dataset index (zero-based).
series - the series index (zero-based).
Returns:
The shape.