com.jrefinery.chart
Class VerticalBarRenderer

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

public class VerticalBarRenderer
extends BarRenderer
implements CategoryItemRenderer

A renderer that handles the drawing of bars for a vertical bar plot.


Field Summary
 
Fields inherited from class com.jrefinery.chart.BarRenderer
BAR_OUTLINE_WIDTH_THRESHOLD, categoryGapSpan, categorySpan, itemGapSpan, itemSpan, itemWidth, zeroInJava2D
 
Fields inherited from class com.jrefinery.chart.AbstractCategoryItemRenderer
info, toolTipGenerator
 
Constructor Summary
VerticalBarRenderer()
          Default constructor, creates a renderer with a standard tool tip generator.
VerticalBarRenderer(com.jrefinery.chart.tooltips.CategoryToolTipGenerator toolTipGenerator)
          Constructs a renderer with a specific tool tip generator.
 
Method Summary
 int barWidthsPerCategory(CategoryDataset data)
          Returns the number of bar-widths displayed in each category.
 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 the bar for a single (series, category) 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 marker for the range axis.
 boolean hasItemGaps()
          Returns true, since for this renderer there are gaps between the items in one category.
 void initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, CategoryPlot plot, CategoryDataset data, ChartRenderingInfo info)
          Initialises the renderer.
 
Methods inherited from class com.jrefinery.chart.BarRenderer
calculateCategoryAndItemSpans, isStacked
 
Methods inherited from class com.jrefinery.chart.AbstractCategoryItemRenderer
drawPlotBackground, getAxisArea, getDataClipRegion, getToolTipGenerator, setToolTipGenerator
 
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
drawPlotBackground, getAxisArea, getDataClipRegion, isStacked
 

Constructor Detail

VerticalBarRenderer

public VerticalBarRenderer()
Default constructor, creates a renderer with a standard tool tip generator.


VerticalBarRenderer

public VerticalBarRenderer(com.jrefinery.chart.tooltips.CategoryToolTipGenerator toolTipGenerator)
Constructs a renderer with a specific tool tip generator.

Parameters:
toolTipGenerator - The tool tip generator.
Method Detail

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 at the start of the process of drawing a chart.

Specified by:
initialise in interface CategoryItemRenderer
Overrides:
initialise in class BarRenderer
Parameters:
g2 - The graphics device.
dataArea - The area in which the data is to be plotted.
plot - The plot.
data - The data.
info - Collects chart rendering information for return to caller.

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 marker for the range axis.

A marker is a constant value, usually represented by a line.

Specified by:
drawRangeMarker in interface CategoryItemRenderer
Parameters:
g2 - The graphics device.
plot - The plot.
axis - The range axis.
marker - The marker to be drawn.
axisDataArea - The area inside the axes.
dataClipRegion - The data area.

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 the bar for a single (series, category) data item.

Specified by:
drawCategoryItem in interface CategoryItemRenderer
Parameters:
g2 - The graphics device.
dataArea - The data 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.

hasItemGaps

public boolean hasItemGaps()
Returns true, since for this renderer there are gaps between the items in one category.

Specified by:
hasItemGaps in class BarRenderer
Returns:
True.

barWidthsPerCategory

public int barWidthsPerCategory(CategoryDataset data)
Returns the number of bar-widths displayed in each category. For this renderer, there is one bar per series, so we return the number of series.

This number is used to calculate the width of a single bar.

Specified by:
barWidthsPerCategory in class BarRenderer
Parameters:
data - The dataset.
Returns:
The number of bar widths across each category.


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.