|
||||||||||
| 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.xy.AbstractXYItemRenderer
org.jfree.chart.renderer.xy.XYBarRenderer
public class XYBarRenderer
A renderer that draws bars on an XYPlot (requires an
IntervalXYDataset).
| Nested Class Summary | |
|---|---|
protected class |
XYBarRenderer.XYBarRendererState
The state class used by this renderer. |
| Field Summary |
|---|
| 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 | |
|---|---|
XYBarRenderer()
The default constructor. |
|
XYBarRenderer(double margin)
Constructs a new renderer. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Returns a clone of the renderer. |
void |
drawItem(java.awt.Graphics2D g2,
XYItemRendererState state,
java.awt.geom.Rectangle2D dataArea,
PlotRenderingInfo info,
XYPlot plot,
ValueAxis domainAxis,
ValueAxis rangeAxis,
XYDataset dataset,
int series,
int item,
CrosshairState crosshairState,
int pass)
Draws the visual representation of a single data item. |
protected void |
drawItemLabel(java.awt.Graphics2D g2,
XYDataset dataset,
int series,
int item,
XYPlot plot,
XYItemLabelGenerator generator,
java.awt.geom.Rectangle2D bar,
boolean negative)
Draws an item label. |
boolean |
equals(java.lang.Object obj)
Tests this renderer for equality with an arbitrary object. |
Range |
findDomainBounds(XYDataset dataset)
Returns the lower and upper bounds (range) of the x-values in 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). |
java.awt.Shape |
getLegendBar()
Returns the shape used to represent bars in each legend item. |
LegendItem |
getLegendItem(int datasetIndex,
int series)
Returns a default legend item for the specified series. |
double |
getMargin()
Returns the margin which is a percentage amount by which the bars are trimmed. |
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. |
boolean |
getUseYInterval()
Returns a flag that determines whether the y-interval from the dataset is used to calculate the length of each bar. |
XYItemRendererState |
initialise(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
XYPlot plot,
XYDataset dataset,
PlotRenderingInfo info)
Initialises the renderer and returns a state object that should be passed to all 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 |
setLegendBar(java.awt.Shape bar)
Sets the shape used to represent bars in each legend item and sends a RendererChangeEvent to all registered listeners. |
void |
setMargin(double margin)
Sets the percentage amount by which the bars are trimmed 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 |
setUseYInterval(boolean use)
Sets the flag that determines whether the y-interval from the dataset is used to calculate the length of each 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.chart.LegendItemSource |
|---|
getLegendItems |
| Constructor Detail |
|---|
public XYBarRenderer()
public XYBarRenderer(double margin)
margin - the percentage amount to trim from the width of each bar.| Method Detail |
|---|
public double getBase()
setBase(double)public void setBase(double base)
RendererChangeEvent
to all registered listeners. The base value is not used if the dataset's
y-interval is being used to determine the bar length.
base - the new base value.getBase(),
getUseYInterval()public boolean getUseYInterval()
setUseYInterval(boolean)public void setUseYInterval(boolean use)
RendererChangeEvent to all registered listeners.
use - the flag.getUseYInterval()public double getMargin()
setMargin(double)public void setMargin(double margin)
RendererChangeEvent to all registered listeners.
margin - the new margin.getMargin()public boolean isDrawBarOutline()
setDrawBarOutline(boolean)public void setDrawBarOutline(boolean draw)
RendererChangeEvent to all registered listeners.
draw - the flag.isDrawBarOutline()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 java.awt.Shape getLegendBar()
null).setLegendBar(Shape)public void setLegendBar(java.awt.Shape bar)
RendererChangeEvent to all registered listeners.
bar - the bar shape (null not permitted).getLegendBar()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).setNegativeItemLabelPositionFallback(ItemLabelPosition)public void setNegativeItemLabelPositionFallback(ItemLabelPosition position)
RendererChangeEvent to all registered
listeners.
position - the position (null permitted).getNegativeItemLabelPositionFallback()
public XYItemRendererState initialise(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
XYPlot plot,
XYDataset dataset,
PlotRenderingInfo info)
initialise in interface XYItemRendererinitialise in class AbstractXYItemRendererg2 - the graphics device.dataArea - the area inside the axes.plot - the plot.dataset - the data.info - an optional info collection object to return data back to
the caller.
public LegendItem getLegendItem(int datasetIndex,
int series)
getLegendItem in interface XYItemRenderergetLegendItem in class AbstractXYItemRendererdatasetIndex - the dataset index (zero-based).series - the series index (zero-based).
public void drawItem(java.awt.Graphics2D g2,
XYItemRendererState state,
java.awt.geom.Rectangle2D dataArea,
PlotRenderingInfo info,
XYPlot plot,
ValueAxis domainAxis,
ValueAxis rangeAxis,
XYDataset dataset,
int series,
int item,
CrosshairState crosshairState,
int pass)
drawItem in interface XYItemRendererg2 - the graphics device.state - the renderer state.dataArea - the area within which the plot is being drawn.info - collects information about the drawing.plot - the plot (can be used to obtain standard color
information etc).domainAxis - the domain axis.rangeAxis - the range axis.dataset - the dataset.series - the series index (zero-based).item - the item index (zero-based).crosshairState - crosshair information for the plot
(null permitted).pass - the pass index.
protected void drawItemLabel(java.awt.Graphics2D g2,
XYDataset dataset,
int series,
int item,
XYPlot plot,
XYItemLabelGenerator generator,
java.awt.geom.Rectangle2D bar,
boolean negative)
AbstractXYItemRenderer.drawItemLabel(Graphics2D, PlotOrientation, XYDataset, int, int,
double, double, boolean) so that the bar can be used to calculate the
label anchor point.
g2 - the graphics device.dataset - the dataset.series - the series index.item - the item index.plot - the plot.generator - the label generator (null permitted, in
which case the method does nothing, just returns).bar - the bar.negative - a flag indicating a negative value.public Range findDomainBounds(XYDataset dataset)
findDomainBounds in interface XYItemRendererfindDomainBounds in class AbstractXYItemRendererdataset - the dataset (null permitted).
null if the dataset is
null or empty).
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface org.jfree.util.PublicCloneableclone in class AbstractXYItemRendererjava.lang.CloneNotSupportedException - if the renderer cannot be cloned.public boolean equals(java.lang.Object obj)
equals in class AbstractXYItemRendererobj - the object to test against (null permitted).
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||