Class WaterfallBarRenderer

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

    public class WaterfallBarRenderer
    extends BarRenderer
    A renderer that handles the drawing of waterfall bar charts, for use with the CategoryPlot class. Some quirks to note:
    • the value in the last category of the dataset should be (redundantly) specified as the sum of the items in the preceding categories - otherwise the final bar in the plot will be incorrectly plotted;
    • the bar colors are defined using special methods in this class - the inherited methods (for example, AbstractRenderer.setSeriesPaint(int, Paint)) are ignored;
    The example shown here is generated by the WaterfallChartDemo1.java program included in the JFreeChart Demo Collection:

    WaterfallBarRendererSample.png
    See Also:
    Serialized Form
    • 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

      • getFirstBarPaint

        public Paint getFirstBarPaint()
        Returns the paint used to draw the first bar.
        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).
      • getLastBarPaint

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

        public void setLastBarPaint​(Paint paint)
        Sets the paint that will be used to draw the last bar and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        paint - the paint (null not permitted).
      • getPositiveBarPaint

        public Paint getPositiveBarPaint()
        Returns the paint used to draw bars with positive values.
        Returns:
        The paint (never null).
      • 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).
      • getNegativeBarPaint

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

        public void setNegativeBarPaint​(Paint paint)
        Sets the paint that will be used to draw bars having negative values, and sends a RendererChangeEvent to all registered listeners.
        Parameters:
        paint - the paint (null not permitted).
      • equals

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