public class LogAxis extends ValueAxis
LogarithmicAxis class.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_COUNTDEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_AXIS_LINE_PAINT, DEFAULT_AXIS_LINE_STROKE, DEFAULT_AXIS_VISIBLE, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_LABELS_VISIBLE, DEFAULT_TICK_MARK_INSIDE_LENGTH, DEFAULT_TICK_MARK_OUTSIDE_LENGTH, DEFAULT_TICK_MARK_PAINT, DEFAULT_TICK_MARK_STROKE, DEFAULT_TICK_MARKS_VISIBLE| Constructor and Description |
|---|
LogAxis()
Creates a new
LogAxis with no label. |
LogAxis(java.lang.String label)
Creates a new
LogAxis with the given label. |
| Modifier and Type | Method and Description |
|---|---|
protected void |
autoAdjustRange()
Adjusts the axis range to match the data range that the axis is
required to display.
|
double |
calculateLog(double value)
Calculates the log of the given value, using the current base.
|
double |
calculateValue(double log)
Calculates the value from a given log.
|
void |
configure()
Configures the axis.
|
static TickUnitSource |
createLogTickUnits(java.util.Locale locale)
Returns a collection of tick units for log (base 10) values.
|
protected java.lang.String |
createTickLabel(double value)
Creates a tick label for the specified value.
|
AxisState |
draw(java.awt.Graphics2D g2,
double cursor,
java.awt.geom.Rectangle2D plotArea,
java.awt.geom.Rectangle2D dataArea,
RectangleEdge edge,
PlotRenderingInfo plotState)
Draws the axis on a Java 2D graphics device (such as the screen or a
printer).
|
boolean |
equals(java.lang.Object obj)
Tests this axis for equality with an arbitrary object.
|
protected double |
estimateMaximumTickLabelHeight(java.awt.Graphics2D g2)
Estimates the maximum tick label height.
|
protected double |
estimateMaximumTickLabelWidth(java.awt.Graphics2D g2,
TickUnit unit)
Estimates the maximum width of the tick labels, assuming the specified
tick unit is used.
|
double |
exponentLengthToJava2D(double length,
java.awt.geom.Rectangle2D area,
RectangleEdge edge)
Converts a length in data coordinates into the corresponding length in
Java2D coordinates.
|
double |
getBase()
Returns the base for the logarithm calculation.
|
java.text.NumberFormat |
getNumberFormatOverride()
Returns the number format override.
|
double |
getSmallestValue()
Returns the smallest value represented by the axis.
|
NumberTickUnit |
getTickUnit()
Returns the current tick unit.
|
int |
hashCode()
Returns a hash code for this instance.
|
double |
java2DToValue(double java2DValue,
java.awt.geom.Rectangle2D area,
RectangleEdge edge)
Converts a Java2D coordinate to an axis value, assuming that the
axis covers the specified
edge of the area. |
void |
pan(double percent)
Slides the axis range by the specified percentage.
|
java.util.List |
refreshTicks(java.awt.Graphics2D g2,
AxisState state,
java.awt.geom.Rectangle2D dataArea,
RectangleEdge edge)
Calculates the positions of the tick labels for the axis, storing the
results in the tick label list (ready for drawing).
|
protected java.util.List |
refreshTicksHorizontal(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
RectangleEdge edge)
Returns a list of ticks for an axis at the top or bottom of the chart.
|
protected java.util.List |
refreshTicksVertical(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
RectangleEdge edge)
Returns a list of ticks for an axis at the left or right of the chart.
|
protected void |
selectAutoTickUnit(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
RectangleEdge edge)
Selects an appropriate tick value for the axis.
|
protected void |
selectHorizontalAutoTickUnit(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
RectangleEdge edge)
Selects an appropriate tick value for the axis.
|
protected void |
selectVerticalAutoTickUnit(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D dataArea,
RectangleEdge edge)
Selects an appropriate tick value for the axis.
|
void |
setBase(double base)
Sets the base for the logarithm calculation and sends an
AxisChangeEvent to all registered listeners. |
void |
setNumberFormatOverride(java.text.NumberFormat formatter)
Sets the number format override.
|
void |
setSmallestValue(double value)
Sets the smallest value represented by the axis and sends an
AxisChangeEvent to all registered listeners. |
void |
setTickUnit(NumberTickUnit unit)
Sets the tick unit for the axis and sends an
AxisChangeEvent to
all registered listeners. |
void |
setTickUnit(NumberTickUnit unit,
boolean notify,
boolean turnOffAutoSelect)
Sets the tick unit for the axis and, if requested, sends an
AxisChangeEvent to all registered listeners. |
double |
valueToJava2D(double value,
java.awt.geom.Rectangle2D area,
RectangleEdge edge)
Converts a value on the axis scale to a Java2D coordinate relative to
the given
area, based on the axis running along the
specified edge. |
void |
zoomRange(double lowerPercent,
double upperPercent)
Zooms in on the current range.
|
calculateAnchorPoint, centerRange, clone, drawAxisLine, drawTickMarksAndLabels, findMaximumTickLabelHeight, findMaximumTickLabelWidth, getAutoRangeMinimumSize, getAutoTickIndex, getDefaultAutoRange, getDownArrow, getFixedAutoRange, getLeftArrow, getLowerBound, getLowerMargin, getMinorTickCount, getRange, getRightArrow, getStandardTickUnits, getUpArrow, getUpperBound, getUpperMargin, isAutoRange, isAutoTickUnitSelection, isInverted, isNegativeArrowVisible, isPositiveArrowVisible, isVerticalTickLabels, lengthToJava2D, reserveSpace, resizeRange, resizeRange, resizeRange2, setAutoRange, setAutoRange, setAutoRangeMinimumSize, setAutoRangeMinimumSize, setAutoTickIndex, setAutoTickUnitSelection, setAutoTickUnitSelection, setDefaultAutoRange, setDownArrow, setFixedAutoRange, setInverted, setLeftArrow, setLowerBound, setLowerMargin, setMinorTickCount, setNegativeArrowVisible, setPositiveArrowVisible, setRange, setRange, setRange, setRangeAboutValue, setRangeWithMargins, setRangeWithMargins, setRangeWithMargins, setRightArrow, setStandardTickUnits, setUpArrow, setUpperBound, setUpperMargin, setVerticalTickLabelsaddChangeListener, createAndAddEntity, drawLabel, fireChangeEvent, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelEnclosure, getLabelFont, getLabelInsets, getLabelPaint, getMinorTickMarkInsideLength, getMinorTickMarkOutsideLength, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, hasListener, isAxisLineVisible, isMinorTickMarksVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, notifyListeners, removeChangeListener, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setFixedDimension, setLabel, setLabelAngle, setLabelFont, setLabelInsets, setLabelInsets, setLabelPaint, setMinorTickMarkInsideLength, setMinorTickMarkOutsideLength, setMinorTickMarksVisible, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisiblepublic LogAxis()
LogAxis with no label.public LogAxis(java.lang.String label)
LogAxis with the given label.label - the axis label (null permitted).public double getBase()
setBase(double)public void setBase(double base)
AxisChangeEvent to all registered listeners.base - the base value (must be > 1.0).getBase()public double getSmallestValue()
setSmallestValue(double)public void setSmallestValue(double value)
AxisChangeEvent to all registered listeners.value - the value.getSmallestValue()public NumberTickUnit getTickUnit()
setTickUnit(NumberTickUnit)public void setTickUnit(NumberTickUnit unit)
AxisChangeEvent to
all registered listeners. A side effect of calling this method is that
the "auto-select" feature for tick units is switched off (you can
restore it using the ValueAxis.setAutoTickUnitSelection(boolean)
method).unit - the new tick unit (null not permitted).getTickUnit()public void setTickUnit(NumberTickUnit unit, boolean notify, boolean turnOffAutoSelect)
AxisChangeEvent to all registered listeners. In addition, an
option is provided to turn off the "auto-select" feature for tick units
(you can restore it using the
ValueAxis.setAutoTickUnitSelection(boolean) method).unit - the new tick unit (null not permitted).notify - notify listeners?turnOffAutoSelect - turn off the auto-tick selection?getTickUnit()public java.text.NumberFormat getNumberFormatOverride()
null).setNumberFormatOverride(NumberFormat)public void setNumberFormatOverride(java.text.NumberFormat formatter)
formatter - the number formatter (null permitted).getNumberFormatOverride()public double calculateLog(double value)
value - the value.calculateValue(double),
getBase()public double calculateValue(double log)
log - the log value (must be > 0.0).calculateLog(double),
getBase()public double java2DToValue(double java2DValue, java.awt.geom.Rectangle2D area, RectangleEdge edge)
edge of the area.java2DToValue in class ValueAxisjava2DValue - the Java2D coordinate.area - the area.edge - the edge that the axis belongs to.ValueAxis.valueToJava2D(double, Rectangle2D, RectangleEdge)public double valueToJava2D(double value, java.awt.geom.Rectangle2D area, RectangleEdge edge)
area, based on the axis running along the
specified edge.valueToJava2D in class ValueAxisvalue - the data value.area - the area.edge - the edge.value.ValueAxis.java2DToValue(double, Rectangle2D, RectangleEdge)public void configure()
protected void autoAdjustRange()
autoAdjustRange in class ValueAxispublic AxisState draw(java.awt.Graphics2D g2, double cursor, java.awt.geom.Rectangle2D plotArea, java.awt.geom.Rectangle2D dataArea, RectangleEdge edge, PlotRenderingInfo plotState)
draw in class Axisg2 - the graphics device (null not permitted).cursor - the cursor location (determines where to draw the axis).plotArea - the area within which the axes and plot should be drawn.dataArea - the area within which the data should be drawn.edge - the axis location (null not permitted).plotState - collects information about the plot
(null permitted).null).public java.util.List refreshTicks(java.awt.Graphics2D g2, AxisState state, java.awt.geom.Rectangle2D dataArea, RectangleEdge edge)
refreshTicks in class Axisg2 - the graphics device.state - the axis state.dataArea - the area in which the plot should be drawn.edge - the location of the axis.protected java.util.List refreshTicksHorizontal(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, RectangleEdge edge)
g2 - the graphics device.dataArea - the data area.edge - the edge.protected java.util.List refreshTicksVertical(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, RectangleEdge edge)
g2 - the graphics device.dataArea - the data area.edge - the edge.protected void selectAutoTickUnit(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, RectangleEdge edge)
g2 - the graphics device.dataArea - the area defined by the axes.edge - the axis location.protected void selectHorizontalAutoTickUnit(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, RectangleEdge edge)
g2 - the graphics device.dataArea - the area defined by the axes.edge - the axis location.public double exponentLengthToJava2D(double length, java.awt.geom.Rectangle2D area, RectangleEdge edge)
length - the length.area - the plot area.edge - the edge along which the axis lies.protected void selectVerticalAutoTickUnit(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D dataArea, RectangleEdge edge)
g2 - the graphics device.dataArea - the area in which the plot should be drawn.edge - the axis location.protected double estimateMaximumTickLabelHeight(java.awt.Graphics2D g2)
g2 - the graphics device.protected double estimateMaximumTickLabelWidth(java.awt.Graphics2D g2, TickUnit unit)
Rather than computing the string bounds of every tick on the axis, we just look at two values: the lower bound and the upper bound for the axis. These two values will usually be representative.
g2 - the graphics device.unit - the tick unit to use for calculation.public void zoomRange(double lowerPercent, double upperPercent)
public void pan(double percent)
protected java.lang.String createTickLabel(double value)
value - the value.public boolean equals(java.lang.Object obj)
public int hashCode()
hashCode in class java.lang.Objectpublic static TickUnitSource createLogTickUnits(java.util.Locale locale)
locale - the locale to use to represent Numbers.Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.