org.jfree.chart.renderer.category

Class WaterfallBarRenderer

public class WaterfallBarRenderer extends BarRenderer implements Cloneable, PublicCloneable, Serializable

A renderer that handles the drawing of waterfall bar charts, for use with the CategoryPlot class. Note that the bar colors are defined using special methods in this class - the inherited methods (for example, AbstractRenderer) are ignored.
Constructor Summary
WaterfallBarRenderer()
Constructs a new renderer with default values for the bar colors.
WaterfallBarRenderer(Paint firstBarPaint, Paint positiveBarPaint, Paint negativeBarPaint, Paint lastBarPaint)
Constructs a new waterfall renderer.
Method Summary
voiddrawItem(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.
booleanequals(Object obj)
Tests an object for equality with this instance.
RangefindRangeBounds(CategoryDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset.
PaintgetFirstBarPaint()
Returns the paint used to draw the first bar.
PaintgetLastBarPaint()
Returns the paint used to draw the last bar.
PaintgetNegativeBarPaint()
Returns the paint used to draw bars with negative values.
PaintgetPositiveBarPaint()
Returns the paint used to draw bars with positive values.
voidsetFirstBarPaint(Paint paint)
Sets the paint that will be used to draw the first bar and sends a RendererChangeEvent to all registered listeners.
voidsetLastBarPaint(Paint paint)
Sets the paint that will be used to draw the last bar.
voidsetNegativeBarPaint(Paint paint)
Sets the paint that will be used to draw bars having negative values.
voidsetPositiveBarPaint(Paint paint)
Sets the paint that will be used to draw bars having positive values.

Constructor Detail

WaterfallBarRenderer

public WaterfallBarRenderer()
Constructs a new renderer with default values for the bar colors.

WaterfallBarRenderer

public WaterfallBarRenderer(Paint firstBarPaint, Paint positiveBarPaint, Paint negativeBarPaint, Paint lastBarPaint)
Constructs a new waterfall renderer.

Parameters: firstBarPaint the color of the first bar (null not permitted). positiveBarPaint the color for bars with positive values (null not permitted). negativeBarPaint the color for bars with negative values (null not permitted). lastBarPaint the color of the last bar (null not permitted).

Method Detail

drawItem

public 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.

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.

equals

public boolean equals(Object obj)
Tests an object for equality with this instance.

Parameters: obj the object (null permitted).

Returns: A boolean.

findRangeBounds

public Range findRangeBounds(CategoryDataset dataset)
Returns the range of values the renderer requires to display all the items from the specified dataset.

Parameters: dataset the dataset (null not permitted).

Returns: The range (or null if the dataset is empty).

getFirstBarPaint

public Paint getFirstBarPaint()
Returns the paint used to draw the first bar.

Returns: The paint (never null).

getLastBarPaint

public Paint getLastBarPaint()
Returns the paint used to draw the last bar.

Returns: The paint (never null).

getNegativeBarPaint

public Paint getNegativeBarPaint()
Returns the paint used to draw bars with negative values.

Returns: The paint (never null).

getPositiveBarPaint

public Paint getPositiveBarPaint()
Returns the paint used to draw bars with positive values.

Returns: The paint (never null).

setFirstBarPaint

public void setFirstBarPaint(Paint paint)
Sets the paint that will be used to draw the first bar and sends a RendererChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

setLastBarPaint

public void setLastBarPaint(Paint paint)
Sets the paint that will be used to draw the last bar.

Parameters: paint the paint (null not permitted).

setNegativeBarPaint

public void setNegativeBarPaint(Paint paint)
Sets the paint that will be used to draw bars having negative values.

Parameters: paint the paint (null not permitted).

setPositiveBarPaint

public void setPositiveBarPaint(Paint paint)
Sets the paint that will be used to draw bars having positive values.

Parameters: paint the paint (null not permitted).