public class BarRenderer extends AbstractCategoryItemRenderer implements Cloneable, org.jfree.util.PublicCloneable, Serializable
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:
Modifier and Type | Field and Description |
---|---|
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.
|
DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, DEFAULT_PAINT, DEFAULT_SHAPE, DEFAULT_STROKE, DEFAULT_VALUE_LABEL_FONT, DEFAULT_VALUE_LABEL_PAINT, ZERO
Constructor and Description |
---|
BarRenderer()
Creates a new bar renderer with default settings.
|
Modifier and Type | Method and Description |
---|---|
void |
drawItem(Graphics2D g2,
CategoryItemRendererState state,
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.
|
boolean |
equals(Object obj)
Tests this instance for equality with an arbitrary object.
|
Range |
findRangeBounds(CategoryDataset dataset,
boolean includeInterval)
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
AbstractCategoryItemRenderer.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.
|
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(Graphics2D g2,
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
AbstractCategoryItemRenderer.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(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. |
clone, drawBackground, drawDomainGridline, drawDomainMarker, drawOutline, drawRangeGridline, drawRangeLine, drawRangeMarker, findRangeBounds, getBaseItemLabelGenerator, getBaseItemURLGenerator, getBaseToolTipGenerator, getColumnCount, getDrawingSupplier, getItemLabelGenerator, getItemMiddle, getItemURLGenerator, getLegendItemLabelGenerator, getLegendItems, getLegendItemToolTipGenerator, getLegendItemURLGenerator, getPassCount, getPlot, getRowCount, getSeriesItemLabelGenerator, getSeriesItemURLGenerator, getSeriesToolTipGenerator, getToolTipGenerator, getToolTipGenerator, hashCode, setBaseItemLabelGenerator, setBaseItemURLGenerator, setBaseToolTipGenerator, setItemLabelGenerator, setItemURLGenerator, setLegendItemLabelGenerator, setLegendItemToolTipGenerator, setLegendItemURLGenerator, setPlot, setSeriesItemLabelGenerator, setSeriesItemURLGenerator, setSeriesToolTipGenerator, setToolTipGenerator
addChangeListener, clearSeriesPaints, clearSeriesStrokes, 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
getClass, notify, notifyAll, toString, wait, wait, wait
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
public static final double DEFAULT_ITEM_MARGIN
public static final double BAR_OUTLINE_WIDTH_THRESHOLD
public BarRenderer()
public static BarPainter getDefaultBarPainter()
public static void setDefaultBarPainter(BarPainter painter)
painter
- the painter (null
not permitted).public static boolean getDefaultShadowsVisible()
shadowsVisible
flag.setDefaultShadowsVisible(boolean)
public static void setDefaultShadowsVisible(boolean visible)
visible
- the new value for the default.getDefaultShadowsVisible()
public double getBase()
0.0
.setBase(double)
public void setBase(double base)
RendererChangeEvent
to all registered listeners.base
- the new base value.getBase()
public double getItemMargin()
setItemMargin(double)
public void setItemMargin(double percent)
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.percent
- the margin (where 0.10 is ten percent).getItemMargin()
public boolean isDrawBarOutline()
setDrawBarOutline(boolean)
public void setDrawBarOutline(boolean draw)
RendererChangeEvent
to all registered listeners.draw
- the flag.isDrawBarOutline()
public double getMaximumBarWidth()
setMaximumBarWidth(double)
public void setMaximumBarWidth(double percent)
RendererChangeEvent
to
all registered listeners.percent
- the percent (where 0.05 is five percent).getMaximumBarWidth()
public double getMinimumBarLength()
setMinimumBarLength(double)
public void setMinimumBarLength(double min)
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.min
- the minimum bar length (in Java2D units, must be >= 0.0).getMinimumBarLength()
public org.jfree.ui.GradientPaintTransformer getGradientPaintTransformer()
null
possible).setGradientPaintTransformer(GradientPaintTransformer)
public void setGradientPaintTransformer(org.jfree.ui.GradientPaintTransformer transformer)
RendererChangeEvent
to all registered listeners.transformer
- the transformer (null
permitted).getGradientPaintTransformer()
public ItemLabelPosition getPositiveItemLabelPositionFallback()
null
possible).setPositiveItemLabelPositionFallback(ItemLabelPosition)
public void setPositiveItemLabelPositionFallback(ItemLabelPosition position)
RendererChangeEvent
to all registered
listeners.position
- the position (null
permitted).getPositiveItemLabelPositionFallback()
public ItemLabelPosition getNegativeItemLabelPositionFallback()
null
possible).setPositiveItemLabelPositionFallback(ItemLabelPosition)
public void setNegativeItemLabelPositionFallback(ItemLabelPosition position)
RendererChangeEvent
to all registered
listeners.position
- the position (null
permitted).getNegativeItemLabelPositionFallback()
public boolean getIncludeBaseInRange()
AbstractCategoryItemRenderer.findRangeBounds(CategoryDataset)
.true
if the base is included in the range, and
false
otherwise.setIncludeBaseInRange(boolean)
public void setIncludeBaseInRange(boolean include)
AbstractCategoryItemRenderer.findRangeBounds(CategoryDataset)
. If the flag is changed,
a RendererChangeEvent
is sent to all registered listeners.include
- the new value for the flag.getIncludeBaseInRange()
public BarPainter getBarPainter()
null
).setBarPainter(BarPainter)
public void setBarPainter(BarPainter painter)
RendererChangeEvent
to all registered listeners.painter
- the painter (null
not permitted).getBarPainter()
public boolean getShadowsVisible()
public void setShadowVisible(boolean visible)
visible
- the new flag value.public Paint getShadowPaint()
setShadowPaint(Paint)
public void setShadowPaint(Paint paint)
RendererChangeEvent
to all
registered listeners.paint
- the paint (null
not permitted).getShadowPaint()
public double getShadowXOffset()
public void setShadowXOffset(double offset)
RendererChangeEvent
to all registered listeners.offset
- the offset.public double getShadowYOffset()
public void setShadowYOffset(double offset)
RendererChangeEvent
to all registered listeners.offset
- the offset.public double getLowerClip()
public double getUpperClip()
public CategoryItemRendererState initialise(Graphics2D g2, Rectangle2D dataArea, CategoryPlot plot, int rendererIndex, PlotRenderingInfo info)
initialise
in interface CategoryItemRenderer
initialise
in class AbstractCategoryItemRenderer
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.public Range findRangeBounds(CategoryDataset dataset, boolean includeInterval)
dataset
- the dataset (null
permitted).includeInterval
- include the interval if the dataset has one?null
if the dataset is
null
or empty).public LegendItem getLegendItem(int datasetIndex, int series)
getLegendItem
in interface CategoryItemRenderer
getLegendItem
in class AbstractCategoryItemRenderer
datasetIndex
- the dataset index (zero-based).series
- the series index (zero-based).null
).AbstractCategoryItemRenderer.getLegendItems()
public void drawItem(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column, int pass)
drawItem
in interface CategoryItemRenderer
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.public boolean equals(Object obj)
equals
in class AbstractCategoryItemRenderer
obj
- the object (null
permitted).Jas4pp 1.5 © Java Analysis Studio for Particle Physics