|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jfree.chart.axis.Axis | +--org.jfree.chart.axis.ValueAxis | +--org.jfree.chart.axis.NumberAxis | +--org.jfree.chart.axis.VerticalNumberAxis
A standard linear value axis, for values displayed vertically.
Note that bug 4273469 on the Java Developer Connection talks about why the grid lines don't always line up with the tick marks precisely.
Field Summary | |
static boolean |
DEFAULT_VERTICAL_LABEL
The default setting for the vertical-label flag. |
Fields inherited from class org.jfree.chart.axis.NumberAxis |
DEFAULT_AUTO_RANGE_INCLUDES_ZERO, DEFAULT_AUTO_RANGE_STICKY_ZERO, DEFAULT_TICK_UNIT |
Fields inherited from class org.jfree.chart.axis.ValueAxis |
DEFAULT_AUTO_RANGE, DEFAULT_AUTO_RANGE_MINIMUM_SIZE, DEFAULT_AUTO_TICK_UNIT_SELECTION, DEFAULT_INVERTED, DEFAULT_LOWER_BOUND, DEFAULT_LOWER_MARGIN, DEFAULT_RANGE, DEFAULT_UPPER_BOUND, DEFAULT_UPPER_MARGIN, MAXIMUM_TICK_COUNT |
Constructor Summary | |
VerticalNumberAxis(java.lang.String label)
Constructs a vertical number axis, using default attribute values where necessary. |
Method Summary | |
protected void |
autoAdjustRange()
Sets the axis minimum and maximum values so that all the data is visible. |
void |
configure()
Configures the axis to work with the specified plot. |
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea,
int location)
Draws the plot on a Java 2D graphics device (such as the screen or a printer). |
protected boolean |
isCompatiblePlot(Plot plot)
Returns true if the specified plot is compatible with the axis. |
boolean |
isVerticalLabel()
Returns a flag indicating whether or not the axis label is drawn vertically. |
void |
refreshTicks(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea,
int location)
Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing). |
double |
reserveWidth(java.awt.Graphics2D g2,
Plot plot,
java.awt.geom.Rectangle2D drawArea,
int location)
Returns the width required to draw the axis in the specified draw area. |
double |
reserveWidth(java.awt.Graphics2D g2,
Plot plot,
java.awt.geom.Rectangle2D plotArea,
int location,
double reservedHeight,
int horizontalAxisLocation)
Returns area in which the axis will be displayed. |
protected void |
selectAutoTickUnit(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea)
Selects an appropriate tick value for the axis. |
void |
setVerticalLabel(boolean flag)
Sets a flag indicating whether or not the axis label is drawn vertically. |
double |
translateJava2DtoValue(float java2DValue,
java.awt.geom.Rectangle2D dataArea)
Converts a coordinate in Java2D space to the corresponding data value, assuming that the axis runs along one edge of the specified dataArea. |
double |
translateValueToJava2D(double value,
java.awt.geom.Rectangle2D dataArea)
Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified dataArea. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean DEFAULT_VERTICAL_LABEL
Constructor Detail |
public VerticalNumberAxis(java.lang.String label)
label
- the axis label (null permitted).Method Detail |
public boolean isVerticalLabel()
public void setVerticalLabel(boolean flag)
flag
- the new flag.public void configure()
configure
in class Axis
public double translateValueToJava2D(double value, java.awt.geom.Rectangle2D dataArea)
Note that it is possible for the coordinate to fall outside the plotArea.
translateValueToJava2D
in class ValueAxis
value
- the data value.dataArea
- the area for plotting the data.
public double translateJava2DtoValue(float java2DValue, java.awt.geom.Rectangle2D dataArea)
translateJava2DtoValue
in class ValueAxis
java2DValue
- the coordinate in Java2D space.dataArea
- the area in which the data is plotted.
protected void autoAdjustRange()
You can control the range calculation in several ways. First, you can define upper and lower margins as a percentage of the data range (the default is a 5% margin for each). Second, you can set a flag that forces the range to include zero. Finally, you can set another flag, the 'sticky zero' flag, that only affects the range when zero falls within the axis margins. When this happens, the margin is truncated so that zero is the upper or lower limit for the axis.
autoAdjustRange
in class ValueAxis
public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, int location)
draw
in class Axis
g2
- the graphics device.plotArea
- the area within which the plot and axes should be drawn.dataArea
- the area within which the data should be drawn.location
- the axis location.public double reserveWidth(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D drawArea, int location)
reserveWidth
in interface VerticalAxis
g2
- the graphics device.plot
- a reference to the plot;drawArea
- the area within which the plot should be drawn.location
- the axis location.
public double reserveWidth(java.awt.Graphics2D g2, Plot plot, java.awt.geom.Rectangle2D plotArea, int location, double reservedHeight, int horizontalAxisLocation)
reserveWidth
in interface VerticalAxis
g2
- the graphics device.plot
- a reference to the plot.plotArea
- the area in which the plot and axes should be drawn.location
- the axis location.reservedHeight
- the height reserved for the horizontal axis.horizontalAxisLocation
- the horizontal axis location.
protected void selectAutoTickUnit(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea)
g2
- the graphics device.plotArea
- the area in which the plot and axes should be drawn.dataArea
- the area in which the plot should be drawn.public void refreshTicks(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, int location)
refreshTicks
in class Axis
g2
- the graphics device.plotArea
- the area in which the plot and the axes should be drawn.dataArea
- the area in which the plot should be drawn.location
- the location of the axis.protected boolean isCompatiblePlot(Plot plot)
This class (VerticalNumberAxis) requires that the plot implements the VerticalValuePlot interface.
isCompatiblePlot
in class Axis
plot
- the plot.
true
if the specified plot is compatible with the axis.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |