org.jfree.chart.renderer.category

Class LayeredBarRenderer

Implemented Interfaces:
Cloneable, PublicCloneable, Serializable, CategoryItemRenderer, LegendItemSource, Serializable

public class LayeredBarRenderer
extends BarRenderer
implements Serializable

A CategoryItemRenderer that represents data using bars which are superimposed.

Field Summary

protected ObjectList
seriesBarWidthList
A list of the width of each series bar.

Fields inherited from class org.jfree.chart.renderer.category.BarRenderer

BAR_OUTLINE_WIDTH_THRESHOLD, DEFAULT_ITEM_MARGIN

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

LayeredBarRenderer()
Default constructor.

Method Summary

protected void
calculateBarWidth(CategoryPlot plot, Rectangle2D dataArea, int rendererIndex, CategoryItemRendererState state)
Calculates the bar width and stores it in the renderer state.
protected void
drawHorizontalItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset data, int row, int column)
Draws the bar for a single (series, category) data item.
void
drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset data, int row, int column, int pass)
Draws the bar for one item in the dataset.
protected void
drawVerticalItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset data, int row, int column)
Draws the bar for a single (series, category) data item.
double
getSeriesBarWidth(int series)
Returns the bar width for a series, or Double.NaN if no width has been set.
void
setSeriesBarWidth(int series, double width)
Sets the width of the bars of a series.

Methods inherited from class org.jfree.chart.renderer.category.BarRenderer

calculateBarL0L1, calculateBarW0, calculateBarWidth, calculateSeriesWidth, drawItem, drawItemLabel, equals, findRangeBounds, getBase, getGradientPaintTransformer, getIncludeBaseInRange, getItemMargin, getLegendItem, getLowerClip, getMaximumBarWidth, getMinimumBarLength, getNegativeItemLabelPositionFallback, getPositiveItemLabelPositionFallback, getUpperClip, initialise, isDrawBarOutline, setBase, setDrawBarOutline, setGradientPaintTransformer, setIncludeBaseInRange, setItemMargin, setMaximumBarWidth, setMinimumBarLength, setNegativeItemLabelPositionFallback, setPositiveItemLabelPositionFallback

Methods inherited from class org.jfree.chart.renderer.category.AbstractCategoryItemRenderer

addItemEntity, calculateDomainMarkerTextAnchorPoint, calculateRangeMarkerTextAnchorPoint, clone, createState, drawBackground, drawDomainGridline, drawDomainMarker, drawItemLabel, drawOutline, drawRangeGridline, drawRangeMarker, equals, findRangeBounds, getBaseItemLabelGenerator, getBaseItemURLGenerator, getBaseToolTipGenerator, getColumnCount, getDomainAxis, getDrawingSupplier, getItemLabelGenerator, getItemURLGenerator, getLegendItem, getLegendItemLabelGenerator, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getLegendItems, getPassCount, getPlot, getRangeAxis, getRowCount, getSeriesItemLabelGenerator, getSeriesItemURLGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, hashCode, initialise, setBaseItemLabelGenerator, setBaseItemURLGenerator, setBaseToolTipGenerator, setItemLabelGenerator, setItemURLGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesItemURLGenerator, setSeriesToolTipGenerator, setToolTipGenerator

Methods inherited from class org.jfree.chart.renderer.AbstractRenderer

addChangeListener, calculateLabelAnchorPoint, clone, equals, fireChangeEvent, getBaseCreateEntities, getBaseFillPaint, getBaseItemLabelFont, getBaseItemLabelPaint, getBaseItemLabelsVisible, getBaseNegativeItemLabelPosition, getBaseOutlinePaint, getBaseOutlineStroke, getBasePaint, getBasePositiveItemLabelPosition, getBaseSeriesVisible, getBaseSeriesVisibleInLegend, getBaseShape, getBaseStroke, getCreateEntities, getDrawingSupplier, getItemCreateEntity, getItemFillPaint, getItemLabelAnchorOffset, getItemLabelFont, getItemLabelFont, getItemLabelPaint, getItemLabelPaint, getItemOutlinePaint, getItemOutlineStroke, getItemPaint, getItemShape, getItemStroke, getItemVisible, getNegativeItemLabelPosition, getNegativeItemLabelPosition, getPositiveItemLabelPosition, getPositiveItemLabelPosition, getSeriesCreateEntities, getSeriesFillPaint, getSeriesItemLabelFont, getSeriesItemLabelPaint, getSeriesNegativeItemLabelPosition, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesPositiveItemLabelPosition, getSeriesShape, getSeriesStroke, getSeriesVisible, getSeriesVisible, getSeriesVisibleInLegend, getSeriesVisibleInLegend, hasListener, hashCode, isItemLabelVisible, isSeriesItemLabelsVisible, isSeriesVisible, isSeriesVisibleInLegend, notifyListeners, removeChangeListener, setBaseCreateEntities, setBaseCreateEntities, setBaseFillPaint, setBaseFillPaint, setBaseItemLabelFont, setBaseItemLabelFont, setBaseItemLabelPaint, setBaseItemLabelPaint, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseItemLabelsVisible, setBaseNegativeItemLabelPosition, setBaseNegativeItemLabelPosition, setBaseOutlinePaint, setBaseOutlinePaint, setBaseOutlineStroke, setBaseOutlineStroke, setBasePaint, setBasePaint, setBasePositiveItemLabelPosition, setBasePositiveItemLabelPosition, setBaseSeriesVisible, setBaseSeriesVisible, setBaseSeriesVisibleInLegend, setBaseSeriesVisibleInLegend, setBaseShape, setBaseShape, setBaseStroke, setBaseStroke, setCreateEntities, setCreateEntities, setFillPaint, setFillPaint, setItemLabelAnchorOffset, setItemLabelFont, setItemLabelFont, setItemLabelPaint, setItemLabelPaint, setItemLabelsVisible, setItemLabelsVisible, setItemLabelsVisible, 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

Field Details

seriesBarWidthList

protected ObjectList seriesBarWidthList
A list of the width of each series bar.

Constructor Details

LayeredBarRenderer

public LayeredBarRenderer()
Default constructor.

Method Details

calculateBarWidth

protected void calculateBarWidth(CategoryPlot plot,
                                 Rectangle2D dataArea,
                                 int rendererIndex,
                                 CategoryItemRendererState state)
Calculates the bar width and stores it in the renderer state.
Overrides:
calculateBarWidth in interface BarRenderer
Parameters:
plot - the plot.
dataArea - the data area.
rendererIndex - the renderer index.
state - the renderer state.

drawHorizontalItem

protected void drawHorizontalItem(Graphics2D g2,
                                  CategoryItemRendererState state,
                                  Rectangle2D dataArea,
                                  CategoryPlot plot,
                                  CategoryAxis domainAxis,
                                  ValueAxis rangeAxis,
                                  CategoryDataset data,
                                  int row,
                                  int column)
Draws the bar for a single (series, category) data item.
Parameters:
g2 - the graphics device.
state - the renderer state.
dataArea - the data area.
plot - the plot.
domainAxis - the domain axis.
rangeAxis - the range axis.
data - the data.
row - the row index (zero-based).
column - the column index (zero-based).

drawItem

public void drawItem(Graphics2D g2,
                     CategoryItemRendererState state,
                     Rectangle2D dataArea,
                     CategoryPlot plot,
                     CategoryAxis domainAxis,
                     ValueAxis rangeAxis,
                     CategoryDataset data,
                     int row,
                     int column,
                     int pass)
Draws the bar for one item in the dataset.
Specified by:
drawItem in interface CategoryItemRenderer
Overrides:
drawItem in interface BarRenderer
Parameters:
g2 - the graphics device.
state - the renderer state.
dataArea - the plot area.
plot - the plot.
domainAxis - the domain (category) axis.
rangeAxis - the range (value) axis.
data - the data.
row - the row index (zero-based).
column - the column index (zero-based).
pass - the pass index.

drawVerticalItem

protected void drawVerticalItem(Graphics2D g2,
                                CategoryItemRendererState state,
                                Rectangle2D dataArea,
                                CategoryPlot plot,
                                CategoryAxis domainAxis,
                                ValueAxis rangeAxis,
                                CategoryDataset data,
                                int row,
                                int column)
Draws the bar for a single (series, category) data item.
Parameters:
g2 - the graphics device.
state - the renderer state.
dataArea - the data area.
plot - the plot.
domainAxis - the domain axis.
rangeAxis - the range axis.
data - the data.
row - the row index (zero-based).
column - the column index (zero-based).

getSeriesBarWidth

public double getSeriesBarWidth(int series)
Returns the bar width for a series, or Double.NaN if no width has been set.
Parameters:
series - the series index (zero based).
Returns:
The width for the series (1.0=100%, it is the maximum).

setSeriesBarWidth

public void setSeriesBarWidth(int series,
                              double width)
Sets the width of the bars of a series.
Parameters:
series - the series index (zero based).
width - the width of the series bar in percentage (1.0=100%, it is the maximum).