Package org.jfree.chart.axis
Class ColorBar
java.lang.Object
org.jfree.chart.axis.ColorBar
- All Implemented Interfaces:
Serializable
,Cloneable
public class ColorBar extends Object implements Cloneable, Serializable
A color bar.
- Author:
- David M. O'Donnell
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static int
DEFAULT_COLORBAR_THICKNESS
The default color bar thickness.static double
DEFAULT_COLORBAR_THICKNESS_PERCENT
The default color bar thickness percentage.static int
DEFAULT_OUTERGAP
The default outer gap. -
Constructor Summary
-
Method Summary
Modifier and Type Method Description void
autoAdjustRange()
Rescales the axis to ensure that all data are visible.Object
clone()
Returns a clone of the object.void
configure(ContourPlot plot)
Configures the color bar.double
draw(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, Rectangle2D reservedArea, org.jfree.ui.RectangleEdge edge)
Draws the plot on a Java 2D graphics device (such as the screen or a printer).void
drawColorBar(Graphics2D g2, Rectangle2D colorBarArea, org.jfree.ui.RectangleEdge edge)
Draws the plot on a Java 2D graphics device (such as the screen or a printer).boolean
equals(Object obj)
Tests this object for equality with another.ValueAxis
getAxis()
Returns the axis.ColorPalette
getColorPalette()
Returns the color palette.Paint
getPaint(double value)
Returns the Paint associated with a value.AxisSpace
reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)
Reserves the space required to draw the color bar.void
setAxis(ValueAxis axis)
Sets the axis.void
setColorPalette(ColorPalette palette)
Sets the color palette.void
setMaximumValue(double value)
Sets the maximum value.void
setMinimumValue(double value)
Sets the minimum value.
-
Field Details
-
DEFAULT_COLORBAR_THICKNESS
public static final int DEFAULT_COLORBAR_THICKNESSThe default color bar thickness.- See Also:
- Constant Field Values
-
DEFAULT_COLORBAR_THICKNESS_PERCENT
public static final double DEFAULT_COLORBAR_THICKNESS_PERCENTThe default color bar thickness percentage.- See Also:
- Constant Field Values
-
DEFAULT_OUTERGAP
public static final int DEFAULT_OUTERGAPThe default outer gap.- See Also:
- Constant Field Values
-
-
Constructor Details
-
ColorBar
Constructs a horizontal colorbar axis, using default values where necessary.- Parameters:
label
- the axis label.
-
-
Method Details
-
configure
Configures the color bar.- Parameters:
plot
- the plot.
-
getAxis
Returns the axis.- Returns:
- The axis.
-
setAxis
Sets the axis.- Parameters:
axis
- the axis.
-
autoAdjustRange
public void autoAdjustRange()Rescales the axis to ensure that all data are visible. -
draw
public double draw(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, Rectangle2D reservedArea, org.jfree.ui.RectangleEdge edge)Draws the plot on a Java 2D graphics device (such as the screen or a printer).- Parameters:
g2
- the graphics device.cursor
- the cursor.plotArea
- the area within which the chart should be drawn.dataArea
- the area within which the plot should be drawn (a subset of the drawArea).reservedArea
- the reserved area.edge
- the color bar location.- Returns:
- The new cursor location.
-
drawColorBar
Draws the plot on a Java 2D graphics device (such as the screen or a printer).- Parameters:
g2
- the graphics device.colorBarArea
- the area within which the axis should be drawn.edge
- the location.
-
getColorPalette
Returns the color palette.- Returns:
- the color palette.
-
getPaint
Returns the Paint associated with a value.- Parameters:
value
- the value.- Returns:
- the paint.
-
setColorPalette
Sets the color palette.- Parameters:
palette
- the new palette.
-
setMaximumValue
public void setMaximumValue(double value)Sets the maximum value.- Parameters:
value
- the maximum value.
-
setMinimumValue
public void setMinimumValue(double value)Sets the minimum value.- Parameters:
value
- the minimum value.
-
reserveSpace
public AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, AxisSpace space)Reserves the space required to draw the color bar.- Parameters:
g2
- the graphics device.plot
- the plot that the axis belongs to.plotArea
- the area within which the plot should be drawn.dataArea
- the data area.edge
- the axis location.space
- the space already reserved.- Returns:
- The space required to draw the axis in the specified plot area.
-
clone
Returns a clone of the object.- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- if some component of the color bar does not support cloning.
-
equals
Tests this object for equality with another.
-