com.jrefinery.chart
Class HorizontalShapeRenderer

java.lang.Object
  |
  +--com.jrefinery.chart.AbstractRenderer
        |
        +--com.jrefinery.chart.AbstractCategoryItemRenderer
              |
              +--com.jrefinery.chart.HorizontalShapeRenderer
All Implemented Interfaces:
CategoryItemRenderer

public class HorizontalShapeRenderer
extends AbstractCategoryItemRenderer

A renderer for a HorizontalCategoryPlot that draws shapes for each data item, and lines between data items. The renderer is immutable so that the only way to change the renderer for a plot is to call the setRenderer() method.

Author:
DG

Field Summary
static int BOTTOM
          Constant indicating that labels are to be shown below data points
static int LEFT
          Constant indicating that labels are to be shown left of data points
static int LINES
          Useful constant for specifying the type of rendering (lines only).
static int RIGHT
          Constant indicating that labels are to be shown right of data points
static int SHAPES
          Useful constant for specifying the type of rendering (shapes only).
static int SHAPES_AND_LINES
          Useful constant for specifying the type of rendering (shapes and lines).
static int TOP
          Constant indicating that labels are to be shown above data points
 
Constructor Summary
HorizontalShapeRenderer()
          Constructs a default renderer (draws shapes and lines).
HorizontalShapeRenderer(int type)
          Constructs a renderer of the specified type.
HorizontalShapeRenderer(int type, int labelPosition)
          Constructs a renderer of the specified type.
HorizontalShapeRenderer(int type, int labelPosition, CategoryToolTipGenerator toolTipGenerator, CategoryURLGenerator urlGenerator)
          Constructs a renderer of the specified type.
 
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)
          Draw a single data item.
 void drawRangeMarker(java.awt.Graphics2D g2, CategoryPlot plot, ValueAxis axis, Marker marker, java.awt.geom.Rectangle2D axisDataArea, java.awt.Shape dataClipRegion)
          Draws a vertical line on the chart to represent the marker.
 java.awt.geom.Rectangle2D getAxisArea(java.awt.geom.Rectangle2D plotArea)
          Returns the area that the axes must fit into.
 
Methods inherited from class com.jrefinery.chart.AbstractCategoryItemRenderer
drawPlotBackground, getCategoriesPaint, getCategoryPaint, getDataClipRegion, getLegendItem, getPlot, getToolTipGenerator, getURLGenerator, getUseCategoriesPaint, initialise, isStacked, setCategoriesPaint, setPlot, setToolTipGenerator, setURLGenerator
 
Methods inherited from class com.jrefinery.chart.AbstractRenderer
addPropertyChangeListener, firePropertyChanged, getInfo, removePropertyChangeListener, setInfo
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHAPES

public static final int SHAPES
Useful constant for specifying the type of rendering (shapes only).

LINES

public static final int LINES
Useful constant for specifying the type of rendering (lines only).

SHAPES_AND_LINES

public static final int SHAPES_AND_LINES
Useful constant for specifying the type of rendering (shapes and lines).

TOP

public static final int TOP
Constant indicating that labels are to be shown above data points

BOTTOM

public static final int BOTTOM
Constant indicating that labels are to be shown below data points

LEFT

public static final int LEFT
Constant indicating that labels are to be shown left of data points

RIGHT

public static final int RIGHT
Constant indicating that labels are to be shown right of data points
Constructor Detail

HorizontalShapeRenderer

public HorizontalShapeRenderer()
Constructs a default renderer (draws shapes and lines).

HorizontalShapeRenderer

public HorizontalShapeRenderer(int type)
Constructs a renderer of the specified type.

Use one of the constants SHAPES, LINES or SHAPES_AND_LINES.

Parameters:
type - The type of renderer.

HorizontalShapeRenderer

public HorizontalShapeRenderer(int type,
                               int labelPosition)
Constructs a renderer of the specified type.

Use one of the constants SHAPES, LINES or SHAPES_AND_LINES.

Parameters:
type - The type of renderer.
labelPosition - Location of labels (if shown) relative to the data points (TOP, BOTTOM, LEFT, or RIGHT).

HorizontalShapeRenderer

public HorizontalShapeRenderer(int type,
                               int labelPosition,
                               CategoryToolTipGenerator toolTipGenerator,
                               CategoryURLGenerator urlGenerator)
Constructs a renderer of the specified type.

Use one of the constants SHAPES, LINES or SHAPES_AND_LINES.

Parameters:
type - The type of renderer.
labelPosition - Location of labels (if shown) relative to the data points (TOP, BOTTOM, LEFT, or RIGHT).
toolTipGenerator - the tool tip generator (null permitted).
urlGenerator - the URL generator (null permitted).
Method Detail

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).
Overrides:
getAxisArea in class AbstractCategoryItemRenderer
Parameters:
plotArea - the plot area.
Returns:
the axis 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 vertical line on the chart to represent the marker.
Parameters:
g2 - The graphics device.
plot - The plot.
axis - The value axis.
marker - The marker line.
axisDataArea - The axis data area.
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)
Draw a single data item.
Parameters:
g2 - The graphics device.
dataArea - The area in which the data is drawn.
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 (will be null when the first category is drawn).