java.lang.Object | |||
↳ | org.jfree.chart.renderer.AbstractRenderer | ||
↳ | org.jfree.chart.renderer.category.AbstractCategoryItemRenderer | ||
↳ | org.jfree.chart.renderer.category.BarRenderer |
![]() |
![]() |
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:
Constants | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
double | BAR_OUTLINE_WIDTH_THRESHOLD | Constant that controls the minimum width before a bar has an outline drawn. | |||||||||
double | DEFAULT_ITEM_MARGIN | The default item margin percentage. |
[Expand]
Inherited Fields | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() |
Public Constructors | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Creates a new bar renderer with default settings.
|
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Draws the bar for a single (series, category) data item.
| |||||||||||
Tests this instance for equality with an arbitrary object.
| |||||||||||
Returns the range of values the renderer requires to display all the
items from the specified dataset.
| |||||||||||
Returns the bar painter.
| |||||||||||
Returns the base value for the bars.
| |||||||||||
Returns the default bar painter.
| |||||||||||
Returns the default value for the
shadowsVisible flag. | |||||||||||
Returns the gradient paint transformer (an object used to transform
gradient paint objects to fit each bar).
| |||||||||||
Returns the flag that controls whether or not the base value for the
bars is included in the range calculated by
findRangeBounds(CategoryDataset) . | |||||||||||
Returns the item margin as a percentage of the available space for all
bars.
| |||||||||||
Returns a legend item for a series.
| |||||||||||
Returns the lower clip value.
| |||||||||||
Returns the maximum bar width, as a percentage of the available drawing
space.
| |||||||||||
Returns the minimum bar length (in Java2D units).
| |||||||||||
Returns the fallback position for negative item labels that don't fit
within a bar.
| |||||||||||
Returns the fallback position for positive item labels that don't fit
within a bar.
| |||||||||||
Returns the shadow paint.
| |||||||||||
Returns the shadow x-offset.
| |||||||||||
Returns the shadow y-offset.
| |||||||||||
Returns the flag that controls whether or not shadows are drawn for
the bars.
| |||||||||||
Returns the upper clip value.
| |||||||||||
Initialises the renderer and returns a state object that will be passed
to subsequent calls to the drawItem method.
| |||||||||||
Returns a flag that controls whether or not bar outlines are drawn.
| |||||||||||
Sets the bar painter for this renderer and sends a
RendererChangeEvent to all registered listeners. | |||||||||||
Sets the base value for the bars and sends a
RendererChangeEvent
to all registered listeners. | |||||||||||
Sets the default bar painter.
| |||||||||||
Sets the default value for the shadows visible flag.
| |||||||||||
Sets the flag that controls whether or not bar outlines are drawn and
sends a
RendererChangeEvent to all registered listeners. | |||||||||||
Sets the gradient paint transformer and sends a
RendererChangeEvent to all registered listeners. | |||||||||||
Sets the flag that controls whether or not the base value for the bars
is included in the range calculated by
findRangeBounds(CategoryDataset) . | |||||||||||
Sets the item margin and sends a
RendererChangeEvent to all
registered listeners. | |||||||||||
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. | |||||||||||
Sets the minimum bar length and sends a
RendererChangeEvent to
all registered listeners. | |||||||||||
Sets the fallback position for negative item labels that don't fit
within a bar, and sends a
RendererChangeEvent to all registered
listeners. | |||||||||||
Sets the fallback position for positive item labels that don't fit
within a bar, and sends a
RendererChangeEvent to all registered
listeners. | |||||||||||
Sets the shadow paint and sends a
RendererChangeEvent to all
registered listeners. | |||||||||||
Sets the flag that controls whether or not shadows are
drawn by the renderer.
| |||||||||||
Sets the x-offset for the bar shadow and sends a
RendererChangeEvent to all registered listeners. | |||||||||||
Sets the y-offset for the bar shadow and sends a
RendererChangeEvent to all registered listeners. |
Protected Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Calculates the coordinates for the length of a single bar.
| |||||||||||
Calculates the coordinate of the first "side" of a bar.
| |||||||||||
Calculates the bar width and stores it in the renderer state.
| |||||||||||
Calculates the available space for each series.
| |||||||||||
Draws an item label.
|
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() | |||||||||||
![]() |
Constant that controls the minimum width before a bar has an outline drawn.
The default item margin percentage.
Creates a new bar renderer with default settings.
Draws the bar for a single (series, category) data item.
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. |
Tests this instance for equality with an arbitrary object.
obj | the object (null permitted). |
---|
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.
dataset | the dataset (null permitted). |
---|
null
if the dataset is
null
or empty).
Returns the base value for the bars. The default value is
0.0
.
Returns the default bar painter.
Returns the default value for the shadowsVisible
flag.
Returns the gradient paint transformer (an object used to transform gradient paint objects to fit each bar).
null
possible).Returns the flag that controls whether or not the base value for the
bars is included in the range calculated by
findRangeBounds(CategoryDataset)
.
true
if the base is included in the range, and
false
otherwise.Returns the item margin as a percentage of the available space for all bars.
Returns a legend item for a series.
datasetIndex | the dataset index (zero-based). |
---|---|
series | the series index (zero-based). |
null
).
Returns the lower clip value. This value is recalculated in the initialise() method.
Returns the maximum bar width, as a percentage of the available drawing space.
Returns the minimum bar length (in Java2D units). The default value is 0.0.
Returns the fallback position for negative item labels that don't fit within a bar.
null
possible).Returns the fallback position for positive item labels that don't fit within a bar.
null
possible).Returns the shadow x-offset.
Returns the shadow y-offset.
Returns the flag that controls whether or not shadows are drawn for the bars.
Returns the upper clip value. This value is recalculated in the initialise() method.
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.
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 a flag that controls whether or not bar outlines are drawn.
Sets the bar painter for this renderer and sends a
RendererChangeEvent
to all registered listeners.
painter | the painter (null not permitted). |
---|
Sets the base value for the bars and sends a RendererChangeEvent
to all registered listeners.
base | the new base value. |
---|
Sets the default bar painter.
painter | the painter (null not permitted). |
---|
Sets the default value for the shadows visible flag.
visible | the new value for the default. |
---|
Sets the flag that controls whether or not bar outlines are drawn and
sends a RendererChangeEvent
to all registered listeners.
draw | the flag. |
---|
Sets the gradient paint transformer and sends a
RendererChangeEvent
to all registered listeners.
transformer | the transformer (null permitted). |
---|
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.
include | the new value for the flag. |
---|
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.
percent | the margin (where 0.10 is ten 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.
percent | the percent (where 0.05 is five percent). |
---|
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.
min | the minimum bar length (in Java2D units, must be >= 0.0). |
---|
Sets the fallback position for negative item labels that don't fit
within a bar, and sends a RendererChangeEvent
to all registered
listeners.
position | the position (null permitted). |
---|
Sets the fallback position for positive item labels that don't fit
within a bar, and sends a RendererChangeEvent
to all registered
listeners.
position | the position (null permitted). |
---|
Sets the shadow paint and sends a RendererChangeEvent
to all
registered listeners.
paint | the paint (null not permitted). |
---|
Sets the flag that controls whether or not shadows are drawn by the renderer.
visible | the new flag value. |
---|
Sets the x-offset for the bar shadow and sends a
RendererChangeEvent
to all registered listeners.
offset | the offset. |
---|
Sets the y-offset for the bar shadow and sends a
RendererChangeEvent
to all registered listeners.
offset | the offset. |
---|
Calculates the coordinates for the length of a single bar.
value | the value represented by the bar. |
---|
null
if
the bar is not visible for the current axis range).
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.
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. |
Calculates the bar width and stores it in the renderer state.
plot | the plot. |
---|---|
dataArea | the data area. |
rendererIndex | the renderer index. |
state | the renderer state. |
Calculates the available space for each 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. |
Draws an item label. This method is overridden so that the bar can be used to calculate the label anchor point.
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. |