Header
And More


org.jfree.chart.renderer.category
Class BarRenderer

java.lang.Object
  extended by org.jfree.chart.renderer.AbstractRenderer
      extended by org.jfree.chart.renderer.category.AbstractCategoryItemRenderer
          extended by org.jfree.chart.renderer.category.BarRenderer
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable, LegendItemSource, CategoryItemRenderer, org.jfree.util.PublicCloneable
Direct Known Subclasses:
BarRenderer3D, IntervalBarRenderer, LayeredBarRenderer, StackedBarRenderer, StatisticalBarRenderer, WaterfallBarRenderer

public class BarRenderer
extends AbstractCategoryItemRenderer
implements java.lang.Cloneable, org.jfree.util.PublicCloneable, java.io.Serializable

A CategoryItemRenderer that draws individual data items as bars. The example shown here is generated by the BarChartDemo1.java program included in the JFreeChart Demo Collection:

BarRendererSample.png

See Also:
Serialized Form

Field Summary
static double BAR_OUTLINE_WIDTH_THRESHOLD
          Constant that controls the minimum width before a bar has an outline drawn.
static double DEFAULT_ITEM_MARGIN
          The default item margin percentage.
 
Fields inherited from class org.jfree.chart.renderer.AbstractRenderer
DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, DEFAULT_PAINT, DEFAULT_SHAPE, DEFAULT_STROKE, DEFAULT_VALUE_LABEL_FONT, DEFAULT_VALUE_LABEL_PAINT, ZERO
 
Constructor Summary
BarRenderer()
          Creates a new bar renderer with default settings.
 
Method Summary
protected  double[] calculateBarL0L1(double value)
          Calculates the coordinates for the length of a single bar.
protected  double calculateBarW0(CategoryPlot plot, PlotOrientation orientation, java.awt.geom.Rectangle2D dataArea, CategoryAxis domainAxis, CategoryItemRendererState state, int row, int column)
          Calculates the coordinate of the first "side" of a bar.
protected  void calculateBarWidth(CategoryPlot plot, java.awt.geom.Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state)
          Calculates the bar width and stores it in the renderer state.
protected  double calculateSeriesWidth(double space, CategoryAxis axis, int categories, int series)
          Calculates the available space for each series.
 void drawItem(java.awt.Graphics2D g2, CategoryItemRendererState state, java.awt.geom.Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass)
          Draws the bar for a single (series, category) data item.
protected  void drawItemLabel(java.awt.Graphics2D g2, CategoryDataset data, int row, int column, CategoryPlot plot, CategoryItemLabelGenerator generator, java.awt.geom.Rectangle2D bar, boolean negative)
          Draws an item label.
 boolean equals(java.lang.Object obj)
          Tests this instance for equality with an arbitrary object.
 Range findRangeBounds(CategoryDataset dataset)
          Returns the range of values the renderer requires to display all the items from the specified dataset.
 BarPainter getBarPainter()
          Returns the bar painter.
 double getBase()
          Returns the base value for the bars.
static BarPainter getDefaultBarPainter()
          Returns the default bar painter.
static boolean getDefaultShadowsVisible()
          Returns the default value for the shadowsVisible flag.
 org.jfree.ui.GradientPaintTransformer getGradientPaintTransformer()
          Returns the gradient paint transformer (an object used to transform gradient paint objects to fit each bar).
 boolean getIncludeBaseInRange()
          Returns the flag that controls whether or not the base value for the bars is included in the range calculated by findRangeBounds(CategoryDataset).
 double getItemMargin()
          Returns the item margin as a percentage of the available space for all bars.
 LegendItem getLegendItem(int datasetIndex, int series)
          Returns a legend item for a series.
 double getLowerClip()
          Returns the lower clip value.
 double getMaximumBarWidth()
          Returns the maximum bar width, as a percentage of the available drawing space.
 double getMinimumBarLength()
          Returns the minimum bar length (in Java2D units).
 ItemLabelPosition getNegativeItemLabelPositionFallback()
          Returns the fallback position for negative item labels that don't fit within a bar.
 ItemLabelPosition getPositiveItemLabelPositionFallback()
          Returns the fallback position for positive item labels that don't fit within a bar.
 java.awt.Paint getShadowPaint()
          Returns the shadow paint.
 boolean getShadowsVisible()
          Returns the flag that controls whether or not shadows are drawn for the bars.
 double getShadowXOffset()
          Returns the shadow x-offset.
 double getShadowYOffset()
          Returns the shadow y-offset.
 double getUpperClip()
          Returns the upper clip value.
 CategoryItemRendererState initialise(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info)
          Initialises the renderer and returns a state object that will be passed to subsequent calls to the drawItem method.
 boolean isDrawBarOutline()
          Returns a flag that controls whether or not bar outlines are drawn.
 void setBarPainter(BarPainter painter)
          Sets the bar painter for this renderer and sends a RendererChangeEvent to all registered listeners.
 void setBase(double base)
          Sets the base value for the bars and sends a RendererChangeEvent to all registered listeners.
static void setDefaultBarPainter(BarPainter painter)
          Sets the default bar painter.
static void setDefaultShadowsVisible(boolean visible)
          Sets the default value for the shadows visible flag.
 void setDrawBarOutline(boolean draw)
          Sets the flag that controls whether or not bar outlines are drawn and sends a RendererChangeEvent to all registered listeners.
 void setGradientPaintTransformer(org.jfree.ui.GradientPaintTransformer transformer)
          Sets the gradient paint transformer and sends a RendererChangeEvent to all registered listeners.
 void setIncludeBaseInRange(boolean include)
          Sets the flag that controls whether or not the base value for the bars is included in the range calculated by findRangeBounds(CategoryDataset).
 void setItemMargin(double percent)
          Sets the item margin and sends a RendererChangeEvent to all registered listeners.
 void setMaximumBarWidth(double percent)
          Sets the maximum bar width, which is specified as a percentage of the available space for all bars, and sends a RendererChangeEvent to all registered listeners.
 void setMinimumBarLength(double min)
          Sets the minimum bar length and sends a RendererChangeEvent to all registered listeners.
 void setNegativeItemLabelPositionFallback(ItemLabelPosition position)
          Sets the fallback position for negative item labels that don't fit within a bar, and sends a RendererChangeEvent to all registered listeners.
 void setPositiveItemLabelPositionFallback(ItemLabelPosition position)
          Sets the fallback position for positive item labels that don't fit within a bar, and sends a RendererChangeEvent to all registered listeners.
 void setShadowPaint(java.awt.Paint paint)
          Sets the shadow paint and sends a RendererChangeEvent to all registered listeners.
 void setShadowVisible(boolean visible)
          Sets the flag that controls whether or not shadows are drawn by the renderer.
 void setShadowXOffset(double offset)
          Sets the x-offset for the bar shadow and sends a RendererChangeEvent to all registered listeners.
 void setShadowYOffset(double offset)
          Sets the y-offset for the bar shadow and sends a RendererChangeEvent to all registered listeners.
 
Methods inherited from class org.jfree.chart.renderer.category.AbstractCategoryItemRenderer
addEntity, addItemEntity, calculateDomainMarkerTextAnchorPoint, calculateRangeMarkerTextAnchorPoint, clone, createState, drawBackground, drawDomainGridline, drawDomainMarker, drawItemLabel, drawOutline, drawRangeGridline, drawRangeLine, drawRangeMarker, findRangeBounds, getBaseItemLabelGenerator, getBaseItemURLGenerator, getBaseToolTipGenerator, getColumnCount, getDomainAxis, getDrawingSupplier, getItemLabelGenerator, getItemMiddle, getItemURLGenerator, getLegendItemLabelGenerator, getLegendItems, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getPassCount, getPlot, getRangeAxis, getRowCount, getSeriesItemLabelGenerator, getSeriesItemURLGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, hashCode, setBaseItemLabelGenerator, setBaseItemURLGenerator, setBaseToolTipGenerator, setItemLabelGenerator, setItemURLGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesItemURLGenerator, setSeriesToolTipGenerator, setToolTipGenerator, updateCrosshairValues
 
Methods inherited from class org.jfree.chart.renderer.AbstractRenderer
addChangeListener, calculateLabelAnchorPoint, clearSeriesPaints, clearSeriesStrokes, fireChangeEvent, getAutoPopulateSeriesFillPaint, getAutoPopulateSeriesOutlinePaint, getAutoPopulateSeriesOutlineStroke, getAutoPopulateSeriesPaint, getAutoPopulateSeriesShape, getAutoPopulateSeriesStroke, getBaseCreateEntities, getBaseFillPaint, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseLegendShape, getBaseLegendTextFont, getBaseLegendTextPaint, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getCreateEntities, getDataBoundsIncludesVisibleSeriesOnly, getDefaultEntityRadius, getItemCreateEntity, getItemFillPaint, getItemLabelAnchorOffset, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getLegendShape, getLegendTextFont, getLegendTextPaint, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, hasListener, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, lookupLegendShape, lookupLegendTextFont, lookupLegendTextPaint, lookupSeriesFillPaint, lookupSeriesOutlinePaint, lookupSeriesOutlineStroke, lookupSeriesPaint, lookupSeriesShape, lookupSeriesStroke, notifyListeners, removeChangeListener, setAutoPopulateSeriesFillPaint, setAutoPopulateSeriesOutlinePaint, setAutoPopulateSeriesOutlineStroke, setAutoPopulateSeriesPaint, setAutoPopulateSeriesShape, setAutoPopulateSeriesStroke, setBaseCreateEntities, setBaseCreateEntities, setBaseFillPaint, setBaseFillPaint, setBaseItemLabelFont, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseLegendShape, setBaseLegendTextFont, setBaseLegendTextPaint, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlinePaint, setBaseOutlineStroke, setBaseOutlineStroke, setBasePaint, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseShape, setBaseStroke, setBaseStroke, setCreateEntities, setCreateEntities, setDataBoundsIncludesVisibleSeriesOnly, setDefaultEntityRadius, setFillPaint, setFillPaint, setItemLabelAnchorOffset, setItemLabelFont, setItemLabelFont, setItemLabelPaint, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setLegendShape, setLegendTextFont, setLegendTextPaint, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlinePaint, setOutlineStroke, setOutlineStroke, setPaint, setPaint, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesCreateEntities, setSeriesCreateEntities, setSeriesFillPaint, setSeriesFillPaint, setSeriesItemLabelFont, setSeriesItemLabelFont, setSeriesItemLabelPaint, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesShape, setSeriesStroke, setSeriesStroke, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setShape, setShape, setStroke, setStroke
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.jfree.util.PublicCloneable
clone
 
Methods inherited from interface org.jfree.chart.renderer.category.CategoryItemRenderer
addChangeListener, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, removeChangeListener, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlineStroke, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseStroke, setItemLabelFont, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, setNegativeItemLabelPosition, setNegativeItemLabelPosition, setOutlinePaint, setOutlineStroke, setPaint, setPositiveItemLabelPosition, setPositiveItemLabelPosition, setSeriesItemLabelFont, setSeriesItemLabelPaint, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesItemLabelsVisible, setSeriesNegativeItemLabelPosition, setSeriesNegativeItemLabelPosition, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesPaint, setSeriesPositiveItemLabelPosition, setSeriesPositiveItemLabelPosition, setSeriesShape, setSeriesStroke, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisible, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setSeriesVisibleInLegend, setShape, setStroke
 

Field Detail

DEFAULT_ITEM_MARGIN

public static final double DEFAULT_ITEM_MARGIN
The default item margin percentage.

See Also:
Constant Field Values

BAR_OUTLINE_WIDTH_THRESHOLD

public static final double BAR_OUTLINE_WIDTH_THRESHOLD
Constant that controls the minimum width before a bar has an outline drawn.

See Also:
Constant Field Values
Constructor Detail

BarRenderer

public BarRenderer()
Creates a new bar renderer with default settings.

Method Detail

getDefaultBarPainter

public static BarPainter getDefaultBarPainter()
Returns the default bar painter.

Returns:
The default bar painter.
Since:
1.0.11

setDefaultBarPainter

public static void setDefaultBarPainter(BarPainter painter)
Sets the default bar painter.

Parameters:
painter - the painter (null not permitted).
Since:
1.0.11

getDefaultShadowsVisible

public static boolean getDefaultShadowsVisible()
Returns the default value for the shadowsVisible flag.

Returns:
A boolean.
Since:
1.0.13
See Also:
setDefaultShadowsVisible(boolean)

setDefaultShadowsVisible

public static void setDefaultShadowsVisible(boolean visible)
Sets the default value for the shadows visible flag.

Parameters:
visible - the new value for the default.
Since:
1.0.13
See Also:
getDefaultShadowsVisible()

getBase

public double getBase()
Returns the base value for the bars. The default value is 0.0.

Returns:
The base value for the bars.
See Also:
setBase(double)

setBase

public void setBase(double base)
Sets the base value for the bars and sends a RendererChangeEvent to all registered listeners.

Parameters:
base - the new base value.
See Also:
getBase()

getItemMargin

public double getItemMargin()
Returns the item margin as a percentage of the available space for all bars.

Returns:
The margin percentage (where 0.10 is ten percent).
See Also:
setItemMargin(double)

setItemMargin

public void setItemMargin(double percent)
Sets the item margin and sends a RendererChangeEvent to all registered listeners. The value is expressed as a percentage of the available width for plotting all the bars, with the resulting amount to be distributed between all the bars evenly.

Parameters:
percent - the margin (where 0.10 is ten percent).
See Also:
getItemMargin()

isDrawBarOutline

public boolean isDrawBarOutline()
Returns a flag that controls whether or not bar outlines are drawn.

Returns:
A boolean.
See Also:
setDrawBarOutline(boolean)

setDrawBarOutline

public void setDrawBarOutline(boolean draw)
Sets the flag that controls whether or not bar outlines are drawn and sends a RendererChangeEvent to all registered listeners.

Parameters:
draw - the flag.
See Also:
isDrawBarOutline()

getMaximumBarWidth

public double getMaximumBarWidth()
Returns the maximum bar width, as a percentage of the available drawing space.

Returns:
The maximum bar width.
See Also:
setMaximumBarWidth(double)

setMaximumBarWidth

public void setMaximumBarWidth(double percent)
Sets the maximum bar width, which is specified as a percentage of the available space for all bars, and sends a RendererChangeEvent to all registered listeners.

Parameters:
percent - the percent (where 0.05 is five percent).
See Also:
getMaximumBarWidth()

getMinimumBarLength

public double getMinimumBarLength()
Returns the minimum bar length (in Java2D units). The default value is 0.0.

Returns:
The minimum bar length.
See Also:
setMinimumBarLength(double)

setMinimumBarLength

public void setMinimumBarLength(double min)
Sets the minimum bar length and sends a RendererChangeEvent to all registered listeners. The minimum bar length is specified in Java2D units, and can be used to prevent bars that represent very small data values from disappearing when drawn on the screen. Typically you would set this to (say) 0.5 or 1.0 Java 2D units. Use this attribute with caution, however, because setting it to a non-zero value will artificially increase the length of bars representing small values, which may misrepresent your data.

Parameters:
min - the minimum bar length (in Java2D units, must be >= 0.0).
See Also:
getMinimumBarLength()

getGradientPaintTransformer

public org.jfree.ui.GradientPaintTransformer getGradientPaintTransformer()
Returns the gradient paint transformer (an object used to transform gradient paint objects to fit each bar).

Returns:
A transformer (null possible).
See Also:
setGradientPaintTransformer(GradientPaintTransformer)

setGradientPaintTransformer

public void setGradientPaintTransformer(org.jfree.ui.GradientPaintTransformer transformer)
Sets the gradient paint transformer and sends a RendererChangeEvent to all registered listeners.

Parameters:
transformer - the transformer (null permitted).
See Also:
getGradientPaintTransformer()

getPositiveItemLabelPositionFallback

public ItemLabelPosition getPositiveItemLabelPositionFallback()
Returns the fallback position for positive item labels that don't fit within a bar.

Returns:
The fallback position (null possible).
See Also:
setPositiveItemLabelPositionFallback(ItemLabelPosition)

setPositiveItemLabelPositionFallback

public void setPositiveItemLabelPositionFallback(ItemLabelPosition position)
Sets the fallback position for positive item labels that don't fit within a bar, and sends a RendererChangeEvent to all registered listeners.

Parameters:
position - the position (null permitted).
See Also:
getPositiveItemLabelPositionFallback()

getNegativeItemLabelPositionFallback

public ItemLabelPosition getNegativeItemLabelPositionFallback()
Returns the fallback position for negative item labels that don't fit within a bar.

Returns:
The fallback position (null possible).
See Also:
setPositiveItemLabelPositionFallback(ItemLabelPosition)

setNegativeItemLabelPositionFallback

public void setNegativeItemLabelPositionFallback(ItemLabelPosition position)
Sets the fallback position for negative item labels that don't fit within a bar, and sends a RendererChangeEvent to all registered listeners.

Parameters:
position - the position (null permitted).
See Also:
getNegativeItemLabelPositionFallback()

getIncludeBaseInRange

public boolean getIncludeBaseInRange()
Returns the flag that controls whether or not the base value for the bars is included in the range calculated by findRangeBounds(CategoryDataset).

Returns:
true if the base is included in the range, and false otherwise.
Since:
1.0.1
See Also:
setIncludeBaseInRange(boolean)

setIncludeBaseInRange

public void setIncludeBaseInRange(boolean include)
Sets the flag that controls whether or not the base value for the bars is included in the range calculated by findRangeBounds(CategoryDataset). If the flag is changed, a RendererChangeEvent is sent to all registered listeners.

Parameters:
include - the new value for the flag.
Since:
1.0.1
See Also:
getIncludeBaseInRange()

getBarPainter

public BarPainter getBarPainter()
Returns the bar painter.

Returns:
The bar painter (never null).
Since:
1.0.11
See Also:
setBarPainter(BarPainter)

setBarPainter

public void setBarPainter(BarPainter painter)
Sets the bar painter for this renderer and sends a RendererChangeEvent to all registered listeners.

Parameters:
painter - the painter (null not permitted).
Since:
1.0.11
See Also:
getBarPainter()

getShadowsVisible

public boolean getShadowsVisible()
Returns the flag that controls whether or not shadows are drawn for the bars.

Returns:
A boolean.
Since:
1.0.11

setShadowVisible

public void setShadowVisible(boolean visible)
Sets the flag that controls whether or not shadows are drawn by the renderer.

Parameters:
visible - the new flag value.
Since:
1.0.11

getShadowPaint

public java.awt.Paint getShadowPaint()
Returns the shadow paint.

Returns:
The shadow paint.
Since:
1.0.11
See Also:
setShadowPaint(Paint)

setShadowPaint

public void setShadowPaint(java.awt.Paint paint)
Sets the shadow paint and sends a RendererChangeEvent to all registered listeners.

Parameters:
paint - the paint (null not permitted).
Since:
1.0.11
See Also:
getShadowPaint()

getShadowXOffset

public double getShadowXOffset()
Returns the shadow x-offset.

Returns:
The shadow x-offset.
Since:
1.0.11

setShadowXOffset

public void setShadowXOffset(double offset)
Sets the x-offset for the bar shadow and sends a RendererChangeEvent to all registered listeners.

Parameters:
offset - the offset.
Since:
1.0.11

getShadowYOffset

public double getShadowYOffset()
Returns the shadow y-offset.

Returns:
The shadow y-offset.
Since:
1.0.11

setShadowYOffset

public void setShadowYOffset(double offset)
Sets the y-offset for the bar shadow and sends a RendererChangeEvent to all registered listeners.

Parameters:
offset - the offset.
Since:
1.0.11

getLowerClip

public double getLowerClip()
Returns the lower clip value. This value is recalculated in the initialise() method.

Returns:
The value.

getUpperClip

public double getUpperClip()
Returns the upper clip value. This value is recalculated in the initialise() method.

Returns:
The value.

initialise

public CategoryItemRendererState initialise(java.awt.Graphics2D g2,
                                            java.awt.geom.Rectangle2D dataArea,
                                            CategoryPlot plot,
                                            int rendererIndex,
                                            PlotRenderingInfo info)
Initialises the renderer and returns a state object that will be passed to subsequent calls to the drawItem method. 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 AbstractCategoryItemRenderer
Parameters:
g2 - the graphics device.
dataArea - the area in which the data is to be plotted.
plot - the plot.
rendererIndex - the renderer index.
info - collects chart rendering information for return to caller.
Returns:
The renderer state.

calculateBarWidth

protected void calculateBarWidth(CategoryPlot plot,
                                 java.awt.geom.Rectangle2D dataArea,
                                 int rendererIndex,
                                 CategoryItemRendererState state)
Calculates the bar width and stores it in the renderer state.

Parameters:
plot - the plot.
dataArea - the data area.
rendererIndex - the renderer index.
state - the renderer state.

calculateBarW0

protected double calculateBarW0(CategoryPlot plot,
                                PlotOrientation orientation,
                                java.awt.geom.Rectangle2D dataArea,
                                CategoryAxis domainAxis,
                                CategoryItemRendererState state,
                                int row,
                                int column)
Calculates the coordinate of the first "side" of a bar. This will be the minimum x-coordinate for a vertical bar, and the minimum y-coordinate for a horizontal bar.

Parameters:
plot - the plot.
orientation - the plot orientation.
dataArea - the data area.
domainAxis - the domain axis.
state - the renderer state (has the bar width precalculated).
row - the row index.
column - the column index.
Returns:
The coordinate.

calculateBarL0L1

protected double[] calculateBarL0L1(double value)
Calculates the coordinates for the length of a single bar.

Parameters:
value - the value represented by the bar.
Returns:
The coordinates for each end of the bar (or null if the bar is not visible for the current axis range).

findRangeBounds

public Range findRangeBounds(CategoryDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset. This takes into account the range of values in the dataset, plus the flag that determines whether or not the base value for the bars should be included in the range.

Specified by:
findRangeBounds in interface CategoryItemRenderer
Overrides:
findRangeBounds in class AbstractCategoryItemRenderer
Parameters:
dataset - the dataset (null permitted).
Returns:
The range (or null if the dataset is null or empty).

getLegendItem

public LegendItem getLegendItem(int datasetIndex,
                                int series)
Returns a legend item for a series.

Specified by:
getLegendItem in interface CategoryItemRenderer
Overrides:
getLegendItem in class AbstractCategoryItemRenderer
Parameters:
datasetIndex - the dataset index (zero-based).
series - the series index (zero-based).
Returns:
The legend item (possibly null).
See Also:
AbstractCategoryItemRenderer.getLegendItems()

drawItem

public void drawItem(java.awt.Graphics2D g2,
                     CategoryItemRendererState state,
                     java.awt.geom.Rectangle2D dataArea,
                     CategoryPlot plot,
                     CategoryAxis domainAxis,
                     ValueAxis rangeAxis,
                     CategoryDataset dataset,
                     int row,
                     int column,
                     int pass)
Draws the bar for a single (series, category) data item.

Specified by:
drawItem in interface CategoryItemRenderer
Parameters:
g2 - the graphics device.
state - the renderer state.
dataArea - the data area.
plot - the plot.
domainAxis - the domain axis.
rangeAxis - the range axis.
dataset - the dataset.
row - the row index (zero-based).
column - the column index (zero-based).
pass - the pass index.

calculateSeriesWidth

protected double calculateSeriesWidth(double space,
                                      CategoryAxis axis,
                                      int categories,
                                      int series)
Calculates the available space for each series.

Parameters:
space - the space along the entire axis (in Java2D units).
axis - the category axis.
categories - the number of categories.
series - the number of series.
Returns:
The width of one series.

drawItemLabel

protected void drawItemLabel(java.awt.Graphics2D g2,
                             CategoryDataset data,
                             int row,
                             int column,
                             CategoryPlot plot,
                             CategoryItemLabelGenerator generator,
                             java.awt.geom.Rectangle2D bar,
                             boolean negative)
Draws an item label. This method is overridden so that the bar can be used to calculate the label anchor point.

Parameters:
g2 - the graphics device.
data - the dataset.
row - the row.
column - the column.
plot - the plot.
generator - the label generator.
bar - the bar.
negative - a flag indicating a negative value.

equals

public boolean equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.

Overrides:
equals in class AbstractCategoryItemRenderer
Parameters:
obj - the object (null permitted).
Returns:
A boolean.

Footer
And More


Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.