org.jfree.chart.renderer.category
public class BarRenderer extends AbstractCategoryItemRenderer implements Cloneable, PublicCloneable, Serializable
BarChartDemo1.java
program included in the JFreeChart Demo Collection:
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. |
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, 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, 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(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.
|
protected void | drawItemLabel(Graphics2D g2, CategoryDataset data, int row, int column, CategoryPlot plot, CategoryItemLabelGenerator generator, Rectangle2D bar, boolean negative)
Draws an item label. |
boolean | equals(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.
|
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.
|
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(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. |
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.
|
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).
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.
Parameters: plot the plot. dataArea the data area. rendererIndex the renderer index. state the renderer state.
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.
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.
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.
Parameters: obj the object (null
permitted).
Returns: A boolean.
Parameters: dataset the dataset (null
permitted).
Returns: The range (or null
if the dataset is
null
or empty).
0.0
.
Returns: The base value for the bars.
See Also: BarRenderer
Returns: The default bar painter.
Since: 1.0.11
Returns: A transformer (null
possible).
See Also: setGradientPaintTransformer
Returns: true
if the base is included in the range, and
false
otherwise.
Since: 1.0.1
See Also: BarRenderer
Returns: The margin percentage (where 0.10 is ten percent).
See Also: BarRenderer
Parameters: datasetIndex the dataset index (zero-based). series the series index (zero-based).
Returns: The legend item (possibly null
).
Returns: The value.
Returns: The maximum bar width.
See Also: BarRenderer
Returns: The minimum bar length.
See Also: BarRenderer
Returns: The fallback position (null
possible).
See Also: setPositiveItemLabelPositionFallback
Returns: The fallback position (null
possible).
See Also: setPositiveItemLabelPositionFallback
Returns: A boolean.
Since: 1.0.11
Returns: The shadow x-offset.
Since: 1.0.11
Returns: The shadow y-offset.
Since: 1.0.11
Returns: The value.
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.
Returns: A boolean.
See Also: BarRenderer
Parameters: painter the painter (null
not permitted).
Since: 1.0.11
Parameters: base the new base value.
See Also: getBase
Parameters: painter the painter (null
not permitted).
Since: 1.0.11
Parameters: visible the new value for the default.
Since: 1.0.13
Parameters: draw the flag.
See Also: isDrawBarOutline
Parameters: transformer the transformer (null
permitted).
See Also: getGradientPaintTransformer
Parameters: include the new value for the flag.
Since: 1.0.1
See Also: getIncludeBaseInRange
Parameters: percent the margin (where 0.10 is ten percent).
See Also: getItemMargin
Parameters: percent the percent (where 0.05 is five percent).
See Also: getMaximumBarWidth
Parameters: min the minimum bar length (in Java2D units, must be >= 0.0).
See Also: getMinimumBarLength
Parameters: position the position (null
permitted).
See Also: getNegativeItemLabelPositionFallback
Parameters: position the position (null
permitted).
See Also: getPositiveItemLabelPositionFallback
Parameters: paint the paint (null
not permitted).
Since: 1.0.11
Parameters: visible the new flag value.
Since: 1.0.11
Parameters: offset the offset.
Since: 1.0.11
Parameters: offset the offset.
Since: 1.0.11