public class BarGraphDrawable extends Object
Constructor and Description |
---|
BarGraphDrawable()
Creates a default bargraph drawable with some sensible default colors and spacings.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(Graphics2D g2,
Rectangle2D drawArea)
Draws the bar-graph into the given Graphics2D context in the given area.
|
Color |
getBackground()
Returns the color for the background of the graph.
|
Color |
getColor()
Returns the main color for the bars.
|
Number[] |
getData()
Returns the numeric data for the drawable or null, if the drawable has no data.
|
Color |
getHighColor()
Returns the color for the highest bars.
|
Color |
getLastColor()
Returns the color for the last bar.
|
int |
getSpacing()
Returns the spacing between the bars.
|
void |
setBackground(Color background)
Defines the color for the background of the graph.
|
void |
setColor(Color color)
Defines the main color for the bars.
|
void |
setData(Number[] data)
Defines the numeric data for the drawable or null, if the drawable has no data.
|
void |
setHighColor(Color highColor)
Defines the color for the highest bars.
|
void |
setLastColor(Color lastColor)
Defines the color for the last bar.
|
void |
setSpacing(int spacing)
Defines the spacing between the bars.
|
public BarGraphDrawable()
public Number[] getData()
public void setData(Number[] data)
data
- the data (can be null).public Color getColor()
public void setColor(Color color)
color
- the main color for the bars, never null.public Color getHighColor()
public void setHighColor(Color highColor)
highColor
- the color for the highest bars, or null if high bars should not be marked specially.public Color getLastColor()
public void setLastColor(Color lastColor)
lastColor
- the color for the last bar in the graph, or null if last bars should not be marked specially.public Color getBackground()
public void setBackground(Color background)
background
- the background or null, if the graph has a transparent background color.public int getSpacing()
public void setSpacing(int spacing)
spacing
- the spacing between the bars.public void draw(Graphics2D g2, Rectangle2D drawArea)
g2
- the graphics context on which the bargraph should be rendered.drawArea
- the area on which the bargraph should be drawn.