com.jrefinery.chart
Class LineAndShapeRenderer

java.lang.Object
  extended by com.jrefinery.chart.AbstractCategoryItemRenderer
      extended by com.jrefinery.chart.LineAndShapeRenderer
All Implemented Interfaces:
CategoryItemRenderer

public class LineAndShapeRenderer
extends AbstractCategoryItemRenderer

A renderer for a CategoryPlot 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.


Field Summary
static int BOTTOM
          Constant indicating that labels are to be shown below data points
protected  int labelPosition
          Location of labels (if shown) relative to the 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).
protected  boolean plotLines
          A flag indicating whether or not lines are drawn between XY points.
protected  boolean plotShapes
          A flag indicating whether or not shapes are drawn at each XY point.
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).
protected  double shapeScale
          Scale factor for standard shapes.
static int TOP
          Constant indicating that labels are to be shown above data points
 
Fields inherited from class com.jrefinery.chart.AbstractCategoryItemRenderer
info, toolTipGenerator
 
Constructor Summary
LineAndShapeRenderer()
          Constructs a default renderer (draws shapes and lines).
LineAndShapeRenderer(int type)
          Constructs a renderer of the specified type.
LineAndShapeRenderer(int type, int labelPosition)
          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 horizontal line across 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, getDataClipRegion, getToolTipGenerator, initialise, isStacked, setToolTipGenerator
 
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).

See Also:
Constant Field Values

LINES

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

See Also:
Constant Field Values

SHAPES_AND_LINES

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

See Also:
Constant Field Values

TOP

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

See Also:
Constant Field Values

BOTTOM

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

See Also:
Constant Field Values

LEFT

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

See Also:
Constant Field Values

RIGHT

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

See Also:
Constant Field Values

plotShapes

protected boolean plotShapes
A flag indicating whether or not shapes are drawn at each XY point.


plotLines

protected boolean plotLines
A flag indicating whether or not lines are drawn between XY points.


shapeScale

protected double shapeScale
Scale factor for standard shapes.


labelPosition

protected int labelPosition
Location of labels (if shown) relative to the data points.

Constructor Detail

LineAndShapeRenderer

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


LineAndShapeRenderer

public LineAndShapeRenderer(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.

LineAndShapeRenderer

public LineAndShapeRenderer(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).
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).

Specified by:
getAxisArea in interface CategoryItemRenderer
Overrides:
getAxisArea in class AbstractCategoryItemRenderer
Parameters:
plotArea - The plot 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 horizontal line across 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).


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.