com.jrefinery.chart
Class HorizontalBarRenderer3D

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

public class HorizontalBarRenderer3D
extends HorizontalBarRenderer

A renderer that handles the drawing of 3D bars for a horizontal bar plot.

Author:
TL

Field Summary
static double DEFAULT_EFFECT3D
          The default 3D effect.
 
Fields inherited from class com.jrefinery.chart.BarRenderer
BAR_OUTLINE_WIDTH_THRESHOLD, categoryGapSpan, categorySpan, itemGapSpan, itemSpan, itemWidth, lowerClip, upperClip, zeroInJava2D
 
Constructor Summary
HorizontalBarRenderer3D()
          Default constructor.
HorizontalBarRenderer3D(double effect3d)
          Creates a new renderer.
HorizontalBarRenderer3D(double effect3d, CategoryToolTipGenerator toolTipGenerator, CategoryURLGenerator urlGenerator)
          Constructs a new renderer.
 
Method Summary
 int barWidthsPerCategory(CategoryDataset data)
          Returns the number of bar widths in each category (used to calculate the width of a single bar).
 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 drawPlotBackground(java.awt.Graphics2D g2, CategoryPlot plot, java.awt.geom.Rectangle2D axisDataArea, java.awt.Shape dataClipArea)
          Draws the background for the plot.
 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 across the chart to represent the marker.
 java.awt.geom.Rectangle2D getAxisArea(java.awt.geom.Rectangle2D plotArea)
          Returns the area that the axes (and date) must fit into.
 java.awt.Shape getDataClipRegion(java.awt.geom.Rectangle2D dataArea)
          Returns the clip region...
 boolean hasItemGaps()
          Returns true to indicate that this renderer does allow for gaps between items.
 
Methods inherited from class com.jrefinery.chart.HorizontalBarRenderer
initialise
 
Methods inherited from class com.jrefinery.chart.BarRenderer
calculateCategoryAndItemSpans, isStacked
 
Methods inherited from class com.jrefinery.chart.AbstractCategoryItemRenderer
getCategoriesPaint, getCategoryPaint, getLegendItem, getPlot, getToolTipGenerator, getURLGenerator, getUseCategoriesPaint, 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
 
Methods inherited from interface com.jrefinery.chart.CategoryItemRenderer
getLegendItem, getPlot, isStacked, setPlot
 

Field Detail

DEFAULT_EFFECT3D

public static final double DEFAULT_EFFECT3D
The default 3D effect.
Constructor Detail

HorizontalBarRenderer3D

public HorizontalBarRenderer3D()
Default constructor.

HorizontalBarRenderer3D

public HorizontalBarRenderer3D(double effect3d)
Creates a new renderer.
Parameters:
effect3d - the size of the 3D effect (in points).

HorizontalBarRenderer3D

public HorizontalBarRenderer3D(double effect3d,
                               CategoryToolTipGenerator toolTipGenerator,
                               CategoryURLGenerator urlGenerator)
Constructs a new renderer.
Parameters:
effect3d - the size of the 3D effect.
toolTipGenerator - the tooltip generator.
urlGenerator - the URL generator.
Method Detail

hasItemGaps

public boolean hasItemGaps()
Returns true to indicate that this renderer does allow for gaps between items.
Overrides:
hasItemGaps in class HorizontalBarRenderer
Returns:
true if this renderer allows gaps between items.

barWidthsPerCategory

public int barWidthsPerCategory(CategoryDataset data)
Returns the number of bar widths in each category (used to calculate the width of a single bar).
Overrides:
barWidthsPerCategory in class HorizontalBarRenderer
Parameters:
data - the data.
Returns:
the number of bar widths in each category.

getAxisArea

public java.awt.geom.Rectangle2D getAxisArea(java.awt.geom.Rectangle2D plotArea)
Returns the area that the axes (and date) 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 dataArea.
Returns:
the area that the axes (and date) must fit into.

getDataClipRegion

public java.awt.Shape getDataClipRegion(java.awt.geom.Rectangle2D dataArea)
Returns the clip region... usually returns the dataArea, but some charts (e.g. 3D) have non rectangular clip regions.
Overrides:
getDataClipRegion in class AbstractCategoryItemRenderer
Parameters:
dataArea - the data area.
Returns:
the clip region.

drawPlotBackground

public void drawPlotBackground(java.awt.Graphics2D g2,
                               CategoryPlot plot,
                               java.awt.geom.Rectangle2D axisDataArea,
                               java.awt.Shape dataClipArea)
Draws the background for the plot.

For most charts, the axisDataArea and the dataClipArea are the same. One case where they are different is the 3D-effect bar charts... here the data clip area extends above and to the right of the axisDataArea.

Overrides:
drawPlotBackground in class AbstractCategoryItemRenderer
Parameters:
g2 - the graphics device.
plot - the plot.
axisDataArea - the area inside the axes.
dataClipArea - the data clip 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 across the chart to represent the marker.
Overrides:
drawRangeMarker in class HorizontalBarRenderer
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)
Draws the bar for a single (series, category) data item.
Overrides:
drawCategoryItem in class HorizontalBarRenderer
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.