Class WaterfallBarRenderer

All Implemented Interfaces:
Serializable, Cloneable, CategoryItemRenderer, org.jfree.util.PublicCloneable

public class WaterfallBarRenderer
extends BarRenderer
implements Cloneable, org.jfree.util.PublicCloneable, Serializable
A renderer that handles the drawing of waterfall bar charts, for use with the CategoryPlot class.
See Also:
Serialized Form
  • Constructor Details

    • 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.
      positiveBarPaint - the color for bars with positive values.
      negativeBarPaint - the color for bars with negative values.
      lastBarPaint - the color of the last bar.
  • Method Details

    • getRangeExtent

      public Range getRangeExtent​(CategoryDataset dataset)
      Returns the range of values the renderer requires to display all the items from the specified dataset.
      Specified by:
      getRangeExtent in interface CategoryItemRenderer
      Overrides:
      getRangeExtent in class AbstractCategoryItemRenderer
      Parameters:
      dataset - the dataset (null permitted).
      Returns:
      The range (or null if the dataset is null or empty).
    • getFirstBarPaint

      public Paint getFirstBarPaint()
      Returns the paint used to draw the first bar.
      Returns:
      The paint.
    • setFirstBarPaint

      public void setFirstBarPaint​(Paint paint)
      Sets the paint that will be used to draw the first bar.
      Parameters:
      paint - the paint.
    • getLastBarPaint

      public Paint getLastBarPaint()
      Returns the paint used to draw the last bar.
      Returns:
      The paint.
    • setLastBarPaint

      public void setLastBarPaint​(Paint paint)
      Sets the paint that will be used to draw the last bar.
      Parameters:
      paint - the paint.
    • getPositiveBarPaint

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

      public void setPositiveBarPaint​(Paint paint)
      Sets the paint that will be used to draw bars having positive values.
      Parameters:
      paint - the paint.
    • getNegativeBarPaint

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

      public void setNegativeBarPaint​(Paint paint)
      Sets the paint that will be used to draw bars having negative values.
      Parameters:
      paint - the paint.
    • drawItem

      public void drawItem​(Graphics2D g2, CategoryItemRendererState state, Rectangle2D dataArea, CategoryPlot plot, CategoryAxis domainAxis, ValueAxis rangeAxis, CategoryDataset dataset, int row, int column)
      Draws the bar for a single (series, category) data item.
      Specified by:
      drawItem in interface CategoryItemRenderer
      Overrides:
      drawItem in class BarRenderer
      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).
    • equals

      public boolean equals​(Object object)
      Tests an object for equality with this instance.
      Overrides:
      equals in class BarRenderer
      Parameters:
      object - the object.
      Returns:
      A boolean.