Package org.jfree.chart.renderer.xy
Class GradientXYBarPainter
- java.lang.Object
-
- org.jfree.chart.renderer.xy.GradientXYBarPainter
-
- All Implemented Interfaces:
java.io.Serializable
,XYBarPainter
public class GradientXYBarPainter extends java.lang.Object implements XYBarPainter, java.io.Serializable
An implementation of theXYBarPainter
interface that uses several gradient fills to enrich the appearance of the bars.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private double
g1
The division point between the first and second gradient regions.private double
g2
The division point between the second and third gradient regions.private double
g3
The division point between the third and fourth gradient regions.
-
Constructor Summary
Constructors Constructor Description GradientXYBarPainter()
Creates a new instance.GradientXYBarPainter(double g1, double g2, double g3)
Creates a new instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private java.awt.geom.Rectangle2D
createShadow(java.awt.geom.RectangularShape bar, double xOffset, double yOffset, RectangleEdge base, boolean pegShadow)
Creates a shadow for the bar.boolean
equals(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.int
hashCode()
Returns a hash code for this instance.void
paintBar(java.awt.Graphics2D g2, XYBarRenderer renderer, int row, int column, java.awt.geom.RectangularShape bar, RectangleEdge base)
Paints a single bar instance.void
paintBarShadow(java.awt.Graphics2D g2, XYBarRenderer renderer, int row, int column, java.awt.geom.RectangularShape bar, RectangleEdge base, boolean pegShadow)
Paints a single bar instance.private java.awt.geom.Rectangle2D[]
splitHorizontalBar(java.awt.geom.RectangularShape bar, double a, double b, double c)
Splits a bar into subregions (elsewhere, these subregions will have different gradients applied to them).private java.awt.geom.Rectangle2D[]
splitVerticalBar(java.awt.geom.RectangularShape bar, double a, double b, double c)
Splits a bar into subregions (elsewhere, these subregions will have different gradients applied to them).
-
-
-
Constructor Detail
-
GradientXYBarPainter
public GradientXYBarPainter()
Creates a new instance.
-
GradientXYBarPainter
public GradientXYBarPainter(double g1, double g2, double g3)
Creates a new instance.- Parameters:
g1
- the division between regions 1 and 2.g2
- the division between regions 2 and 3.g3
- the division between regions 3 and 4.
-
-
Method Detail
-
paintBar
public void paintBar(java.awt.Graphics2D g2, XYBarRenderer renderer, int row, int column, java.awt.geom.RectangularShape bar, RectangleEdge base)
Paints a single bar instance.- Specified by:
paintBar
in interfaceXYBarPainter
- Parameters:
g2
- the graphics target.renderer
- the renderer.row
- the row index.column
- the column index.bar
- the barbase
- indicates which side of the rectangle is the base of the bar.
-
paintBarShadow
public void paintBarShadow(java.awt.Graphics2D g2, XYBarRenderer renderer, int row, int column, java.awt.geom.RectangularShape bar, RectangleEdge base, boolean pegShadow)
Paints a single bar instance.- Specified by:
paintBarShadow
in interfaceXYBarPainter
- Parameters:
g2
- the graphics target.renderer
- the renderer.row
- the row index.column
- the column index.bar
- the barbase
- indicates which side of the rectangle is the base of the bar.pegShadow
- peg the shadow to the base of the bar?
-
createShadow
private java.awt.geom.Rectangle2D createShadow(java.awt.geom.RectangularShape bar, double xOffset, double yOffset, 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 java.awt.geom.Rectangle2D[] splitVerticalBar(java.awt.geom.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 java.awt.geom.Rectangle2D[] splitHorizontalBar(java.awt.geom.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(java.lang.Object obj)
Tests this instance for equality with an arbitrary object.- Overrides:
equals
in classjava.lang.Object
- Parameters:
obj
- the obj (null
permitted).- Returns:
- A boolean.
-
hashCode
public int hashCode()
Returns a hash code for this instance.- Overrides:
hashCode
in classjava.lang.Object
- Returns:
- A hash code.
-
-