com.jrefinery.chart
Class StackedHorizontalBarRenderer

java.lang.Object
  extended by com.jrefinery.chart.AbstractCategoryItemRenderer
      extended by com.jrefinery.chart.BarRenderer
          extended by com.jrefinery.chart.HorizontalBarRenderer
              extended by com.jrefinery.chart.StackedHorizontalBarRenderer
All Implemented Interfaces:
CategoryItemRenderer

public class StackedHorizontalBarRenderer
extends HorizontalBarRenderer

A renderer that handles the drawing of "stacked" bars for a horizontal 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
StackedHorizontalBarRenderer()
          Constructs a renderer with a standard tool tip generator.
StackedHorizontalBarRenderer(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" per 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 a stacked bar for a specific item.
 boolean hasItemGaps()
          Returns a flag (always false for this renderer) to indicate whether or not there are gaps between items in the plot.
 boolean isStacked()
          Returns true, to indicate that this renderer stacks values.
 
Methods inherited from class com.jrefinery.chart.HorizontalBarRenderer
drawRangeMarker, initialise
 
Methods inherited from class com.jrefinery.chart.BarRenderer
calculateCategoryAndItemSpans
 
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
 

Constructor Detail

StackedHorizontalBarRenderer

public StackedHorizontalBarRenderer()
Constructs a renderer with a standard tool tip generator.


StackedHorizontalBarRenderer

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

Parameters:
toolTipGenerator - The tool tip generator.
Method Detail

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 stacked bar for a specific item.

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

isStacked

public boolean isStacked()
Returns true, to indicate that this renderer stacks values. This affects the axis range required to display all values.

Specified by:
isStacked in interface CategoryItemRenderer
Overrides:
isStacked in class BarRenderer
Returns:
Always true.

hasItemGaps

public boolean hasItemGaps()
Returns a flag (always false for this renderer) to indicate whether or not there are gaps between items in the plot.

Overrides:
hasItemGaps in class HorizontalBarRenderer
Returns:
Always false.

barWidthsPerCategory

public int barWidthsPerCategory(CategoryDataset data)
Returns the number of "bar widths" per category.

For this style of rendering, there is only one bar per category.

Overrides:
barWidthsPerCategory in class HorizontalBarRenderer
Parameters:
data - The dataset (ignored).
Returns:
Always 1.


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.