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_COUNT
DEFAULT_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(String label)
Creates a new
LogAxis with the given label. |
Modifier and Type | Method and Description |
---|---|
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(Locale locale)
Deprecated.
This method is no longer used internally and will be removed
from a future version. If you need this method, copy the source
code into your project.
|
AxisState |
draw(Graphics2D g2,
double cursor,
Rectangle2D plotArea,
Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge,
PlotRenderingInfo plotState)
Draws the axis on a Java 2D graphics device (such as the screen or a
printer).
|
boolean |
equals(Object obj)
Tests this axis for equality with an arbitrary object.
|
double |
exponentLengthToJava2D(double length,
Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Converts a length in data coordinates into the corresponding length in
Java2D coordinates.
|
double |
getBase()
Returns the base for the logarithm calculation.
|
Format |
getBaseFormatter()
Returns the formatter used to format the base value of the logarithmic
scale when it is displayed numerically.
|
String |
getBaseSymbol()
Returns the symbol used to represent the base of the logarithmic scale
for the axis.
|
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,
Rectangle2D area,
org.jfree.ui.RectangleEdge edge)
Converts a Java2D coordinate to an axis value, assuming that the
axis is aligned to the specified
edge of the area . |
void |
pan(double percent)
Slides the axis range by the specified percentage.
|
List |
refreshTicks(Graphics2D g2,
AxisState state,
Rectangle2D dataArea,
org.jfree.ui.RectangleEdge edge)
Calculates the positions of the tick labels for the axis, storing the
results in the tick label list (ready for drawing).
|
void |
resizeRange(double percent)
Increases or decreases the axis range by the specified percentage about
the central value and sends an
AxisChangeEvent to all registered
listeners. |
void |
resizeRange(double percent,
double anchorValue)
Increases or decreases the axis range by the specified percentage about
the specified anchor value and sends an
AxisChangeEvent to all
registered listeners. |
void |
resizeRange2(double percent,
double anchorValue)
Resizes the axis length to the specified percentage of the current
range and sends a change event to all registered listeners.
|
void |
setBase(double base)
Sets the base for the logarithm calculation and sends a change event to
all registered listeners.
|
void |
setBaseFormatter(Format formatter)
Sets the formatter used to format the base value of the logarithmic
scale when it is displayed numerically and sends a change event to all
registered listeners.
|
void |
setBaseSymbol(String symbol)
Sets the symbol used to represent the base value of the logarithmic
scale and sends a change event to all registered listeners.
|
void |
setNumberFormatOverride(NumberFormat formatter)
Sets the number format override and sends a change event to all
registered listeners.
|
void |
setSmallestValue(double value)
Sets the smallest value represented by the axis and sends a change event
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,
Rectangle2D area,
org.jfree.ui.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.
|
centerRange, clone, getAutoRangeMinimumSize, getDefaultAutoRange, getDownArrow, getFixedAutoRange, getLeftArrow, getLowerBound, getLowerMargin, getMinorTickCount, getRange, getRightArrow, getStandardTickUnits, getUpArrow, getUpperBound, getUpperMargin, isAutoRange, isAutoTickUnitSelection, isInverted, isNegativeArrowVisible, isPositiveArrowVisible, isVerticalTickLabels, lengthToJava2D, reserveSpace, setAutoRange, setAutoRangeMinimumSize, setAutoRangeMinimumSize, setAutoTickUnitSelection, setAutoTickUnitSelection, setDefaultAutoRange, setDownArrow, setFixedAutoRange, setInverted, setLeftArrow, setLowerBound, setLowerMargin, setMinorTickCount, setNegativeArrowVisible, setPositiveArrowVisible, setRange, setRange, setRange, setRangeAboutValue, setRangeWithMargins, setRangeWithMargins, setRangeWithMargins, setRightArrow, setStandardTickUnits, setUpArrow, setUpperBound, setUpperMargin, setVerticalTickLabels
addChangeListener, createAttributedLabel, getAttributedLabel, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelFont, getLabelInsets, getLabelLocation, getLabelPaint, getMinorTickMarkInsideLength, getMinorTickMarkOutsideLength, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, hasListener, isAxisLineVisible, isMinorTickMarksVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, removeChangeListener, setAttributedLabel, setAttributedLabel, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setFixedDimension, setLabel, setLabelAngle, setLabelFont, setLabelInsets, setLabelInsets, setLabelLocation, setLabelPaint, setMinorTickMarkInsideLength, setMinorTickMarkOutsideLength, setMinorTickMarksVisible, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisible
public LogAxis()
LogAxis
with no label.public LogAxis(String label)
LogAxis
with the given label.label
- the axis label (null
permitted).public double getBase()
10.0
.setBase(double)
public void setBase(double base)
base
- the base value (must be > 1.0).getBase()
public String getBaseSymbol()
null
(the default) then the
numerical value of the base is displayed.null
).public void setBaseSymbol(String symbol)
symbol
- the symbol (null
permitted).public Format getBaseFormatter()
new DecimalFormat("0")
.null
).public void setBaseFormatter(Format formatter)
formatter
- the formatter (null
not permitted).public double getSmallestValue()
setSmallestValue(double)
public void setSmallestValue(double value)
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 NumberFormat getNumberFormatOverride()
null
,
then it will be used to format the numbers on the axis.null
).setNumberFormatOverride(NumberFormat)
public void setNumberFormatOverride(NumberFormat formatter)
null
, then it will be
used to format the numbers on the axis.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.calculateLog(double)
,
getBase()
public double java2DToValue(double java2DValue, Rectangle2D area, org.jfree.ui.RectangleEdge edge)
edge
of the area
.java2DToValue
in class ValueAxis
java2DValue
- the Java2D coordinate.area
- the area for plotting data (null
not
permitted).edge
- the edge that the axis is aligned to (null
not
permitted).ValueAxis.valueToJava2D(double, Rectangle2D, RectangleEdge)
public double valueToJava2D(double value, Rectangle2D area, org.jfree.ui.RectangleEdge edge)
area
, based on the axis running along the
specified edge
.valueToJava2D
in class ValueAxis
value
- the data value.area
- the area (null
not permitted).edge
- the edge (null
not permitted).value
.ValueAxis.java2DToValue(double, Rectangle2D, RectangleEdge)
public void configure()
public AxisState draw(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge, PlotRenderingInfo plotState)
draw
in class Axis
g2
- 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 List refreshTicks(Graphics2D g2, AxisState state, Rectangle2D dataArea, org.jfree.ui.RectangleEdge edge)
refreshTicks
in class Axis
g2
- the graphics device.state
- the axis state.dataArea
- the area in which the plot should be drawn.edge
- the location of the axis.public double exponentLengthToJava2D(double length, Rectangle2D area, org.jfree.ui.RectangleEdge edge)
length
- the length.area
- the plot area.edge
- the edge along which the axis lies.public void zoomRange(double lowerPercent, double upperPercent)
public void pan(double percent)
public void resizeRange(double percent)
AxisChangeEvent
to all registered
listeners.
To double the length of the axis range, use 200% (2.0). To halve the length of the axis range, use 50% (0.5).
resizeRange
in class ValueAxis
percent
- the resize factor.resizeRange(double, double)
public void resizeRange(double percent, double anchorValue)
ValueAxis
AxisChangeEvent
to all
registered listeners.
To double the length of the axis range, use 200% (2.0). To halve the length of the axis range, use 50% (0.5).
resizeRange
in class ValueAxis
percent
- the resize factor.anchorValue
- the new central value after the resize.ValueAxis.resizeRange(double)
public void resizeRange2(double percent, double anchorValue)
percent
is greater than 1.0 (100 percent) then the axis
range is increased (which has the effect of zooming out), while if the
percent
is less than 1.0 the axis range is decreased
(which has the effect of zooming in). The resize occurs around an
anchor value (which may not be in the center of the axis). This is used
to support mouse wheel zooming around an arbitrary point on the plot.
resizeRange2
in class ValueAxis
percent
- the percentage (must be greater than zero).anchorValue
- the anchor value.ValueAxis.resizeRange(double)
public boolean equals(Object obj)
public int hashCode()
public static TickUnitSource createLogTickUnits(Locale locale)
locale
- the locale to use to represent Numbers.Jas4pp 1.5 © Java Analysis Studio for Particle Physics