|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.jfree.chart.renderer.AbstractRenderer
org.jfree.chart.renderer.category.AbstractCategoryItemRenderer
org.jfree.chart.renderer.category.BarRenderer
public class BarRenderer
A CategoryItemRenderer that draws individual data items as bars.
| 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. |
double |
getBase()
Returns the base value for the bars. |
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. |
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 |
setBase(double base)
Sets the base value for the bars and sends a RendererChangeEvent
to all registered listeners. |
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. |
| Methods inherited from class java.lang.Object |
|---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
| Methods inherited from interface org.jfree.util.PublicCloneable |
|---|
clone |
| Field Detail |
|---|
public static final double DEFAULT_ITEM_MARGIN
public static final double BAR_OUTLINE_WIDTH_THRESHOLD
| Constructor Detail |
|---|
public BarRenderer()
| Method Detail |
|---|
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.
min - the minimum bar length (in Java2D units).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()
findRangeBounds(CategoryDataset).
true if the base is included in the range, and
false otherwise.setIncludeBaseInRange(boolean)public void setIncludeBaseInRange(boolean include)
findRangeBounds(CategoryDataset). If the flag is changed,
a RendererChangeEvent is sent to all registered listeners.
include - the new value for the flag.getIncludeBaseInRange()public double getLowerClip()
public double getUpperClip()
public CategoryItemRendererState initialise(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
CategoryPlot plot,
int rendererIndex,
PlotRenderingInfo info)
initialise in interface CategoryItemRendererinitialise in class AbstractCategoryItemRendererg2 - 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.
protected void calculateBarWidth(CategoryPlot plot,
java.awt.geom.Rectangle2D dataArea,
int rendererIndex,
CategoryItemRendererState state)
plot - the plot.dataArea - the data area.rendererIndex - the renderer index.state - the renderer state.
protected double calculateBarW0(CategoryPlot plot,
PlotOrientation orientation,
java.awt.geom.Rectangle2D dataArea,
CategoryAxis domainAxis,
CategoryItemRendererState state,
int row,
int column)
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.
protected double[] calculateBarL0L1(double value)
value - the value represented by the bar.
null if
the bar is not visible for the current axis range).public Range findRangeBounds(CategoryDataset dataset)
findRangeBounds in interface CategoryItemRendererfindRangeBounds in class AbstractCategoryItemRendererdataset - the dataset (null permitted).
null if the dataset is
null or empty).
public LegendItem getLegendItem(int datasetIndex,
int series)
getLegendItem in interface CategoryItemRenderergetLegendItem in class AbstractCategoryItemRendererdatasetIndex - the dataset index (zero-based).series - the series index (zero-based).
null).AbstractCategoryItemRenderer.getLegendItems()
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)
drawItem in interface CategoryItemRendererg2 - 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.
protected double calculateSeriesWidth(double space,
CategoryAxis axis,
int categories,
int series)
space - the space along the entire axis (in Java2D units).axis - the category axis.categories - the number of categories.series - the number of series.
protected void drawItemLabel(java.awt.Graphics2D g2,
CategoryDataset data,
int row,
int column,
CategoryPlot plot,
CategoryItemLabelGenerator generator,
java.awt.geom.Rectangle2D bar,
boolean negative)
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.public boolean equals(java.lang.Object obj)
equals in class AbstractCategoryItemRendererobj - the object (null permitted).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||