Class GradientBarPainter

java.lang.Object
org.jfree.chart.renderer.category.GradientBarPainter
All Implemented Interfaces:
Serializable, BarPainter

public class GradientBarPainter extends Object implements BarPainter, Serializable
An implementation of the BarPainter interface that uses several gradient fills to enrich the appearance of the bars.
Since:
1.0.11
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private double
    The division point between the first and second gradient regions.
    private double
    The division point between the second and third gradient regions.
    private double
    The division point between the third and fourth gradient regions.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Creates a new instance.
    GradientBarPainter(double g1, double g2, double g3)
    Creates a new instance.
  • Method Summary

    Modifier and Type
    Method
    Description
    private Rectangle2D
    createShadow(RectangularShape bar, double xOffset, double yOffset, org.jfree.ui.RectangleEdge base, boolean pegShadow)
    Creates a shadow for the bar.
    boolean
    Tests this instance for equality with an arbitrary object.
    int
    Returns a hash code for this instance.
    void
    paintBar(Graphics2D g2, BarRenderer renderer, int row, int column, RectangularShape bar, org.jfree.ui.RectangleEdge base)
    Paints a single bar instance.
    void
    paintBarShadow(Graphics2D g2, BarRenderer renderer, int row, int column, RectangularShape bar, org.jfree.ui.RectangleEdge base, boolean pegShadow)
    Paints a single bar instance.
    private Rectangle2D[]
    splitHorizontalBar(RectangularShape bar, double a, double b, double c)
    Splits a bar into subregions (elsewhere, these subregions will have different gradients applied to them).
    private Rectangle2D[]
    splitVerticalBar(RectangularShape bar, double a, double b, double c)
    Splits a bar into subregions (elsewhere, these subregions will have different gradients applied to them).

    Methods inherited from class java.lang.Object

    clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • g1

      private double g1
      The division point between the first and second gradient regions.
    • g2

      private double g2
      The division point between the second and third gradient regions.
    • g3

      private double g3
      The division point between the third and fourth gradient regions.
  • Constructor Details

    • GradientBarPainter

      public GradientBarPainter()
      Creates a new instance.
    • GradientBarPainter

      public GradientBarPainter(double g1, double g2, double g3)
      Creates a new instance.
      Parameters:
      g1 - percentage value defining the line between regions 1 and 2.
      g2 - percentage value defining the line between regions 2 and 3.
      g3 - percentage value defining the line between regions 3 and 4.
  • Method Details

    • paintBar

      public void paintBar(Graphics2D g2, BarRenderer renderer, int row, int column, RectangularShape bar, org.jfree.ui.RectangleEdge base)
      Paints a single bar instance.
      Specified by:
      paintBar in interface BarPainter
      Parameters:
      g2 - the graphics target.
      renderer - the renderer.
      row - the row index.
      column - the column index.
      bar - the bar
      base - indicates which side of the rectangle is the base of the bar.
    • paintBarShadow

      public void paintBarShadow(Graphics2D g2, BarRenderer renderer, int row, int column, RectangularShape bar, org.jfree.ui.RectangleEdge base, boolean pegShadow)
      Paints a single bar instance.
      Specified by:
      paintBarShadow in interface BarPainter
      Parameters:
      g2 - the graphics target.
      renderer - the renderer.
      row - the row index.
      column - the column index.
      bar - the bar
      base - indicates which side of the rectangle is the base of the bar.
      pegShadow - peg the shadow to the base of the bar?
    • createShadow

      private Rectangle2D createShadow(RectangularShape bar, double xOffset, double yOffset, org.jfree.ui.RectangleEdge base, boolean pegShadow)
      Creates a shadow for the bar.
      Parameters:
      bar - the bar shape.
      xOffset - the x-offset for the shadow.
      yOffset - the y-offset for the shadow.
      base - the edge that is the base of the bar.
      pegShadow - peg the shadow to the base?
      Returns:
      A rectangle for the shadow.
    • splitVerticalBar

      private Rectangle2D[] splitVerticalBar(RectangularShape bar, double a, double b, double c)
      Splits a bar into subregions (elsewhere, these subregions will have different gradients applied to them).
      Parameters:
      bar - the bar shape.
      a - the first division.
      b - the second division.
      c - the third division.
      Returns:
      An array containing four subregions.
    • splitHorizontalBar

      private Rectangle2D[] splitHorizontalBar(RectangularShape bar, double a, double b, double c)
      Splits a bar into subregions (elsewhere, these subregions will have different gradients applied to them).
      Parameters:
      bar - the bar shape.
      a - the first division.
      b - the second division.
      c - the third division.
      Returns:
      An array containing four subregions.
    • equals

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

      public int hashCode()
      Returns a hash code for this instance.
      Overrides:
      hashCode in class Object
      Returns:
      A hash code.