Package org.jfree.chart.axis
Class ValueAxis
java.lang.Object
org.jfree.chart.axis.Axis
org.jfree.chart.axis.ValueAxis
- All Implemented Interfaces:
Serializable,Cloneable,PublicCloneable
- Direct Known Subclasses:
DateAxis,LogAxis,NumberAxis,PeriodAxis
The base class for axes that display value data, where values are measured
using the
double primitive. The two key subclasses are
DateAxis and NumberAxis.- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanFlag that indicates whether the axis automatically scales to fit the chart data.private doubleThe minimum size for the 'auto' axis range (excluding margins).private intAn index into an array of standard tick values.private booleanFlag that indicates whether or not the tick unit is selected automatically.static final booleanThe default auto-range value.static final doubleThe default minimum auto range.static final booleanThe default auto-tick-unit-selection value.static final booleanThe default inverted flag setting.static final doubleThe default value for the lower margin (0.05 = 5%).static final RangeThe default axis range.static final doubleThe default value for the upper margin (0.05 = 5%).private RangeThe default range is used when the dataset is empty and the axis needs to determine the auto range.private ShapeThe shape used for a down arrow.private doubleIf this value is positive, the amount is subtracted from the maximum data value to determine the lower axis range.private booleanA flag that affects the orientation of the values on the axis.private ShapeThe shape used for a left arrow.private doubleThe lower margin.static final intThe maximum tick count.private intThe number of minor ticks per major tick unit.private booleanA flag that controls whether an arrow is drawn at the negative end of the axis line.private booleanA flag that controls whether an arrow is drawn at the positive end of the axis line.private RangeThe axis range.private ShapeThe shape used for a right arrow.private static final longFor serialization.private TickUnitSourceThe standard tick units for the axis.private ShapeThe shape used for an up arrow.private doubleThe upper margin percentage.private booleanA flag indicating whether or not tick labels are rotated to vertical.Fields inherited from class org.jfree.chart.axis.Axis
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 Summary
ConstructorsModifierConstructorDescriptionprotectedValueAxis(String label, TickUnitSource standardTickUnits) Constructs a value axis. -
Method Summary
Modifier and TypeMethodDescriptionprotected abstract voidAutomatically sets the axis range to fit the range of values in the dataset.protected float[]calculateAnchorPoint(ValueTick tick, double cursor, Rectangle2D dataArea, RectangleEdge edge) Calculates the anchor point for a tick label.voidcenterRange(double value) Centers the axis range about the specified value and sends anAxisChangeEventto all registered listeners.clone()Returns a clone of the object.protected voiddrawAxisLine(Graphics2D g2, double cursor, Rectangle2D dataArea, RectangleEdge edge) Draws an axis line at the current cursor position and edge.protected AxisStatedrawTickMarksAndLabels(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge) Draws the axis line, tick marks and tick mark labels.booleanTests the axis for equality with an arbitrary object.protected doublefindMaximumTickLabelHeight(List ticks, Graphics2D g2, Rectangle2D drawArea, boolean vertical) A utility method for determining the height of the tallest tick label.protected doublefindMaximumTickLabelWidth(List ticks, Graphics2D g2, Rectangle2D drawArea, boolean vertical) A utility method for determining the width of the widest tick label.doubleReturns the minimum size allowed for the axis range when it is automatically calculated.protected intReturns the auto tick index.Returns the default auto range.Returns a shape that can be displayed as an arrow pointing downwards at the end of an axis line.doubleReturns the fixed auto range.Returns a shape that can be displayed as an arrow pointing left at the end of an axis line.doubleReturns the lower bound of the axis range.doubleReturns the lower margin for the axis, expressed as a percentage of the axis range.intReturns the number of minor tick marks to display.getRange()Returns the range for the axis.Returns a shape that can be displayed as an arrow pointing right at the end of an axis line.Returns the source for obtaining standard tick units for the axis.Returns a shape that can be displayed as an arrow pointing upwards at the end of an axis line.doubleReturns the upper bound for the axis range.doubleReturns the upper margin for the axis, expressed as a percentage of the axis range.booleanReturns the flag that controls whether or not the axis range is automatically adjusted to fit the data values.booleanReturns a flag indicating whether or not the tick unit is automatically selected from a range of standard tick units.booleanReturns a flag that controls the direction of values on the axis.booleanReturns a flag that controls whether or not the axis line has an arrow drawn that points in the negative direction for the axis.booleanReturns a flag that controls whether or not the axis line has an arrow drawn that points in the positive direction for the axis.booleanReturnstrueif the tick labels should be rotated (to vertical), andfalseotherwise.abstract doublejava2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) Converts a coordinate in Java2D space to the corresponding data value, assuming that the axis runs along one edge of the specified dataArea.doublelengthToJava2D(double length, Rectangle2D area, RectangleEdge edge) Converts a length in data coordinates into the corresponding length in Java2D coordinates.voidpan(double percent) Slides the axis range by the specified percentage.private voidreadObject(ObjectInputStream stream) Provides serialization support.reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space) Returns the space required to draw the axis.voidresizeRange(double percent) Increases or decreases the axis range by the specified percentage about the central value and sends anAxisChangeEventto all registered listeners.voidresizeRange(double percent, double anchorValue) Increases or decreases the axis range by the specified percentage about the specified anchor value and sends anAxisChangeEventto all registered listeners.voidresizeRange2(double percent, double anchorValue) Increases or decreases the axis range by the specified percentage about the specified anchor value and sends anAxisChangeEventto all registered listeners.voidsetAutoRange(boolean auto) Sets a flag that determines whether or not the axis range is automatically adjusted to fit the data, and notifies registered listeners that the axis has been modified.protected voidsetAutoRange(boolean auto, boolean notify) Sets the auto range attribute.voidsetAutoRangeMinimumSize(double size) Sets the auto range minimum size and sends anAxisChangeEventto all registered listeners.voidsetAutoRangeMinimumSize(double size, boolean notify) Sets the minimum size allowed for the axis range when it is automatically calculated.protected voidsetAutoTickIndex(int index) Sets the auto tick index.voidsetAutoTickUnitSelection(boolean flag) Sets a flag indicating whether or not the tick unit is automatically selected from a range of standard tick units.voidsetAutoTickUnitSelection(boolean flag, boolean notify) Sets a flag indicating whether or not the tick unit is automatically selected from a range of standard tick units.voidsetDefaultAutoRange(Range range) Sets the default auto range and sends anAxisChangeEventto all registered listeners.voidsetDownArrow(Shape arrow) Sets the shape that can be displayed as an arrow pointing downwards at the end of an axis line and sends anAxisChangeEventto all registered listeners.voidsetFixedAutoRange(double length) Sets the fixed auto range for the axis.voidsetInverted(boolean flag) Sets a flag that controls the direction of values on the axis, and notifies registered listeners that the axis has changed.voidsetLeftArrow(Shape arrow) Sets the shape that can be displayed as an arrow pointing left at the end of an axis line and sends anAxisChangeEventto all registered listeners.voidsetLowerBound(double min) Sets the lower bound for the axis range.voidsetLowerMargin(double margin) Sets the lower margin for the axis (as a percentage of the axis range) and sends anAxisChangeEventto all registered listeners.voidsetMinorTickCount(int count) Sets the number of minor tick marks to display, and sends anAxisChangeEventto all registered listeners.voidsetNegativeArrowVisible(boolean visible) Sets a flag that controls whether or not the axis lines has an arrow drawn that points in the negative direction for the axis, and sends anAxisChangeEventto all registered listeners.voidsetPositiveArrowVisible(boolean visible) Sets a flag that controls whether or not the axis lines has an arrow drawn that points in the positive direction for the axis, and sends anAxisChangeEventto all registered listeners.voidsetRange(double lower, double upper) Sets the range for the axis and sends a change event to all registered listeners.voidSets the range for the axis and sends a change event to all registered listeners.voidSets the range for the axis and, if requested, sends a change event to all registered listeners.voidsetRangeAboutValue(double value, double length) Sets the axis range, where the new range is 'size' in length, and centered on 'value'.voidsetRangeWithMargins(double lower, double upper) Sets the axis range (after first adding the current margins to the range) and sends anAxisChangeEventto all registered listeners.voidsetRangeWithMargins(Range range) Sets the range for the axis (after first adding the current margins to the specified range) and sends anAxisChangeEventto all registered listeners.voidsetRangeWithMargins(Range range, boolean turnOffAutoRange, boolean notify) Sets the range for the axis after first adding the current margins to the range and, if requested, sends anAxisChangeEventto all registered listeners.voidsetRightArrow(Shape arrow) Sets the shape that can be displayed as an arrow pointing rightwards at the end of an axis line and sends anAxisChangeEventto all registered listeners.voidsetStandardTickUnits(TickUnitSource source) Sets the source for obtaining standard tick units for the axis and sends anAxisChangeEventto all registered listeners.voidsetUpArrow(Shape arrow) Sets the shape that can be displayed as an arrow pointing upwards at the end of an axis line and sends anAxisChangeEventto all registered listeners.voidsetUpperBound(double max) Sets the upper bound for the axis range, and sends anAxisChangeEventto all registered listeners.voidsetUpperMargin(double margin) Sets the upper margin for the axis (as a percentage of the axis range) and sends anAxisChangeEventto all registered listeners.voidsetVerticalTickLabels(boolean flag) Sets the flag that controls whether the tick labels are displayed vertically (that is, rotated 90 degrees from horizontal).abstract doublevalueToJava2D(double value, Rectangle2D area, RectangleEdge edge) Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified dataArea.private voidwriteObject(ObjectOutputStream stream) Provides serialization support.voidzoomRange(double lowerPercent, double upperPercent) Zooms in on the current range.Methods inherited from class org.jfree.chart.axis.Axis
addChangeListener, configure, createAndAddEntity, createAttributedLabel, draw, drawAttributedLabel, drawLabel, fireChangeEvent, getAttributedLabel, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelEnclosure, getLabelFont, getLabelInsets, getLabelLocation, getLabelPaint, getMinorTickMarkInsideLength, getMinorTickMarkOutsideLength, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, hashCode, hasListener, isAxisLineVisible, isMinorTickMarksVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, labelAnchorH, labelAnchorV, labelLocationX, labelLocationY, notifyListeners, refreshTicks, 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
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization.- See Also:
-
DEFAULT_RANGE
The default axis range. -
DEFAULT_AUTO_RANGE
public static final boolean DEFAULT_AUTO_RANGEThe default auto-range value.- See Also:
-
DEFAULT_INVERTED
public static final boolean DEFAULT_INVERTEDThe default inverted flag setting.- See Also:
-
DEFAULT_AUTO_RANGE_MINIMUM_SIZE
public static final double DEFAULT_AUTO_RANGE_MINIMUM_SIZEThe default minimum auto range.- See Also:
-
DEFAULT_LOWER_MARGIN
public static final double DEFAULT_LOWER_MARGINThe default value for the lower margin (0.05 = 5%).- See Also:
-
DEFAULT_UPPER_MARGIN
public static final double DEFAULT_UPPER_MARGINThe default value for the upper margin (0.05 = 5%).- See Also:
-
DEFAULT_AUTO_TICK_UNIT_SELECTION
public static final boolean DEFAULT_AUTO_TICK_UNIT_SELECTIONThe default auto-tick-unit-selection value.- See Also:
-
MAXIMUM_TICK_COUNT
public static final int MAXIMUM_TICK_COUNTThe maximum tick count.- See Also:
-
positiveArrowVisible
private boolean positiveArrowVisibleA flag that controls whether an arrow is drawn at the positive end of the axis line. -
negativeArrowVisible
private boolean negativeArrowVisibleA flag that controls whether an arrow is drawn at the negative end of the axis line. -
upArrow
The shape used for an up arrow. -
downArrow
The shape used for a down arrow. -
leftArrow
The shape used for a left arrow. -
rightArrow
The shape used for a right arrow. -
inverted
private boolean invertedA flag that affects the orientation of the values on the axis. -
range
The axis range. -
autoRange
private boolean autoRangeFlag that indicates whether the axis automatically scales to fit the chart data. -
autoRangeMinimumSize
private double autoRangeMinimumSizeThe minimum size for the 'auto' axis range (excluding margins). -
defaultAutoRange
The default range is used when the dataset is empty and the axis needs to determine the auto range. -
upperMargin
private double upperMarginThe upper margin percentage. This indicates the amount by which the maximum axis value exceeds the maximum data value (as a percentage of the range on the axis) when the axis range is determined automatically. -
lowerMargin
private double lowerMarginThe lower margin. This is a percentage that indicates the amount by which the minimum axis value is "less than" the minimum data value when the axis range is determined automatically. -
fixedAutoRange
private double fixedAutoRangeIf this value is positive, the amount is subtracted from the maximum data value to determine the lower axis range. This can be used to provide a fixed "window" on dynamic data. -
autoTickUnitSelection
private boolean autoTickUnitSelectionFlag that indicates whether or not the tick unit is selected automatically. -
standardTickUnits
The standard tick units for the axis. -
autoTickIndex
private int autoTickIndexAn index into an array of standard tick values. -
minorTickCount
private int minorTickCountThe number of minor ticks per major tick unit. This is an override field, if the value is > 0 it is used, otherwise the axis refers to the minorTickCount in the current tickUnit. -
verticalTickLabels
private boolean verticalTickLabelsA flag indicating whether or not tick labels are rotated to vertical.
-
-
Constructor Details
-
ValueAxis
Constructs a value axis.- Parameters:
label- the axis label (nullpermitted).standardTickUnits- the source for standard tick units (nullpermitted).
-
-
Method Details
-
isVerticalTickLabels
public boolean isVerticalTickLabels()Returnstrueif the tick labels should be rotated (to vertical), andfalseotherwise.- Returns:
trueorfalse.- See Also:
-
setVerticalTickLabels
public void setVerticalTickLabels(boolean flag) Sets the flag that controls whether the tick labels are displayed vertically (that is, rotated 90 degrees from horizontal). If the flag is changed, anAxisChangeEventis sent to all registered listeners.- Parameters:
flag- the flag.- See Also:
-
isPositiveArrowVisible
public boolean isPositiveArrowVisible()Returns a flag that controls whether or not the axis line has an arrow drawn that points in the positive direction for the axis.- Returns:
- A boolean.
- See Also:
-
setPositiveArrowVisible
public void setPositiveArrowVisible(boolean visible) Sets a flag that controls whether or not the axis lines has an arrow drawn that points in the positive direction for the axis, and sends anAxisChangeEventto all registered listeners.- Parameters:
visible- the flag.- See Also:
-
isNegativeArrowVisible
public boolean isNegativeArrowVisible()Returns a flag that controls whether or not the axis line has an arrow drawn that points in the negative direction for the axis.- Returns:
- A boolean.
- See Also:
-
setNegativeArrowVisible
public void setNegativeArrowVisible(boolean visible) Sets a flag that controls whether or not the axis lines has an arrow drawn that points in the negative direction for the axis, and sends anAxisChangeEventto all registered listeners.- Parameters:
visible- the flag.- See Also:
-
getUpArrow
Returns a shape that can be displayed as an arrow pointing upwards at the end of an axis line.- Returns:
- A shape (never
null). - See Also:
-
setUpArrow
Sets the shape that can be displayed as an arrow pointing upwards at the end of an axis line and sends anAxisChangeEventto all registered listeners.- Parameters:
arrow- the arrow shape (nullnot permitted).- See Also:
-
getDownArrow
Returns a shape that can be displayed as an arrow pointing downwards at the end of an axis line.- Returns:
- A shape (never
null). - See Also:
-
setDownArrow
Sets the shape that can be displayed as an arrow pointing downwards at the end of an axis line and sends anAxisChangeEventto all registered listeners.- Parameters:
arrow- the arrow shape (nullnot permitted).- See Also:
-
getLeftArrow
Returns a shape that can be displayed as an arrow pointing left at the end of an axis line.- Returns:
- A shape (never
null). - See Also:
-
setLeftArrow
Sets the shape that can be displayed as an arrow pointing left at the end of an axis line and sends anAxisChangeEventto all registered listeners.- Parameters:
arrow- the arrow shape (nullnot permitted).- See Also:
-
getRightArrow
Returns a shape that can be displayed as an arrow pointing right at the end of an axis line.- Returns:
- A shape (never
null). - See Also:
-
setRightArrow
Sets the shape that can be displayed as an arrow pointing rightwards at the end of an axis line and sends anAxisChangeEventto all registered listeners.- Parameters:
arrow- the arrow shape (nullnot permitted).- See Also:
-
drawAxisLine
Draws an axis line at the current cursor position and edge.- Overrides:
drawAxisLinein classAxis- Parameters:
g2- the graphics device (nullnot permitted).cursor- the cursor position.dataArea- the data area.edge- the edge.
-
calculateAnchorPoint
protected float[] calculateAnchorPoint(ValueTick tick, double cursor, Rectangle2D dataArea, RectangleEdge edge) Calculates the anchor point for a tick label.- Parameters:
tick- the tick.cursor- the cursor.dataArea- the data area.edge- the edge on which the axis is drawn.- Returns:
- The x and y coordinates of the anchor point.
-
drawTickMarksAndLabels
protected AxisState drawTickMarksAndLabels(Graphics2D g2, double cursor, Rectangle2D plotArea, Rectangle2D dataArea, RectangleEdge edge) Draws the axis line, tick marks and tick mark labels.- Parameters:
g2- the graphics device (nullnot permitted).cursor- the cursor.plotArea- the plot area (nullnot permitted).dataArea- the data area (nullnot permitted).edge- the edge that the axis is aligned with (nullnot permitted).- Returns:
- The width or height used to draw the axis.
-
reserveSpace
public AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space) Returns the space required to draw the axis.- Specified by:
reserveSpacein classAxis- Parameters:
g2- the graphics device.plot- the plot that the axis belongs to.plotArea- the area within which the plot should be drawn.edge- the axis location.space- the space already reserved (for other axes).- Returns:
- The space required to draw the axis (including pre-reserved space).
-
findMaximumTickLabelHeight
protected double findMaximumTickLabelHeight(List ticks, Graphics2D g2, Rectangle2D drawArea, boolean vertical) A utility method for determining the height of the tallest tick label.- Parameters:
ticks- the ticks.g2- the graphics device.drawArea- the area within which the plot and axes should be drawn.vertical- a flag that indicates whether or not the tick labels are 'vertical'.- Returns:
- The height of the tallest tick label.
-
findMaximumTickLabelWidth
protected double findMaximumTickLabelWidth(List ticks, Graphics2D g2, Rectangle2D drawArea, boolean vertical) A utility method for determining the width of the widest tick label.- Parameters:
ticks- the ticks.g2- the graphics device.drawArea- the area within which the plot and axes should be drawn.vertical- a flag that indicates whether or not the tick labels are 'vertical'.- Returns:
- The width of the tallest tick label.
-
isInverted
public boolean isInverted()Returns a flag that controls the direction of values on the axis.For a regular axis, values increase from left to right (for a horizontal axis) and bottom to top (for a vertical axis). When the axis is 'inverted', the values increase in the opposite direction.
- Returns:
- The flag.
- See Also:
-
setInverted
public void setInverted(boolean flag) Sets a flag that controls the direction of values on the axis, and notifies registered listeners that the axis has changed.- Parameters:
flag- the flag.- See Also:
-
isAutoRange
public boolean isAutoRange()Returns the flag that controls whether or not the axis range is automatically adjusted to fit the data values.- Returns:
- The flag.
- See Also:
-
setAutoRange
public void setAutoRange(boolean auto) Sets a flag that determines whether or not the axis range is automatically adjusted to fit the data, and notifies registered listeners that the axis has been modified.- Parameters:
auto- the new value of the flag.- See Also:
-
setAutoRange
protected void setAutoRange(boolean auto, boolean notify) Sets the auto range attribute. If thenotifyflag is set, anAxisChangeEventis sent to registered listeners.- Parameters:
auto- the flag.notify- notify listeners?- See Also:
-
getAutoRangeMinimumSize
public double getAutoRangeMinimumSize()Returns the minimum size allowed for the axis range when it is automatically calculated.- Returns:
- The minimum range.
- See Also:
-
setAutoRangeMinimumSize
public void setAutoRangeMinimumSize(double size) Sets the auto range minimum size and sends anAxisChangeEventto all registered listeners.- Parameters:
size- the size.- See Also:
-
setAutoRangeMinimumSize
public void setAutoRangeMinimumSize(double size, boolean notify) Sets the minimum size allowed for the axis range when it is automatically calculated.If requested, an
AxisChangeEventis forwarded to all registered listeners.- Parameters:
size- the new minimum.notify- notify listeners?
-
getDefaultAutoRange
Returns the default auto range.- Returns:
- The default auto range (never
null). - See Also:
-
setDefaultAutoRange
Sets the default auto range and sends anAxisChangeEventto all registered listeners.- Parameters:
range- the range (nullnot permitted).- See Also:
-
getLowerMargin
public double getLowerMargin()Returns the lower margin for the axis, expressed as a percentage of the axis range. This controls the space added to the lower end of the axis when the axis range is automatically calculated (it is ignored when the axis range is set explicitly). The default value is 0.05 (five percent).- Returns:
- The lower margin.
- See Also:
-
setLowerMargin
public void setLowerMargin(double margin) Sets the lower margin for the axis (as a percentage of the axis range) and sends anAxisChangeEventto all registered listeners. This margin is added only when the axis range is auto-calculated - if you set the axis range manually, the margin is ignored.- Parameters:
margin- the margin percentage (for example, 0.05 is five percent).- See Also:
-
getUpperMargin
public double getUpperMargin()Returns the upper margin for the axis, expressed as a percentage of the axis range. This controls the space added to the lower end of the axis when the axis range is automatically calculated (it is ignored when the axis range is set explicitly). The default value is 0.05 (five percent).- Returns:
- The upper margin.
- See Also:
-
setUpperMargin
public void setUpperMargin(double margin) Sets the upper margin for the axis (as a percentage of the axis range) and sends anAxisChangeEventto all registered listeners. This margin is added only when the axis range is auto-calculated - if you set the axis range manually, the margin is ignored.- Parameters:
margin- the margin percentage (for example, 0.05 is five percent).- See Also:
-
getFixedAutoRange
public double getFixedAutoRange()Returns the fixed auto range.- Returns:
- The length.
- See Also:
-
setFixedAutoRange
public void setFixedAutoRange(double length) Sets the fixed auto range for the axis.- Parameters:
length- the range length.- See Also:
-
getLowerBound
public double getLowerBound()Returns the lower bound of the axis range.- Returns:
- The lower bound.
- See Also:
-
setLowerBound
public void setLowerBound(double min) Sets the lower bound for the axis range. AnAxisChangeEventis sent to all registered listeners.- Parameters:
min- the new minimum.- See Also:
-
getUpperBound
public double getUpperBound()Returns the upper bound for the axis range.- Returns:
- The upper bound.
- See Also:
-
setUpperBound
public void setUpperBound(double max) Sets the upper bound for the axis range, and sends anAxisChangeEventto all registered listeners.- Parameters:
max- the new maximum.- See Also:
-
getRange
Returns the range for the axis.- Returns:
- The axis range (never
null). - See Also:
-
setRange
Sets the range for the axis and sends a change event to all registered listeners. As a side-effect, the auto-range flag is set tofalse.- Parameters:
range- the range (nullnot permitted).- See Also:
-
setRange
Sets the range for the axis and, if requested, sends a change event to all registered listeners. Furthermore, ifturnOffAutoRangeistrue, the auto-range flag is set tofalse(normally when setting the axis range manually the caller expects that range to remain in force).- Parameters:
range- the range (nullnot permitted).turnOffAutoRange- a flag that controls whether or not the auto range is turned off.notify- a flag that controls whether or not listeners are notified.- See Also:
-
setRange
public void setRange(double lower, double upper) Sets the range for the axis and sends a change event to all registered listeners. As a side-effect, the auto-range flag is set tofalse.- Parameters:
lower- the lower axis limit.upper- the upper axis limit.- See Also:
-
setRangeWithMargins
Sets the range for the axis (after first adding the current margins to the specified range) and sends anAxisChangeEventto all registered listeners.- Parameters:
range- the range (nullnot permitted).
-
setRangeWithMargins
Sets the range for the axis after first adding the current margins to the range and, if requested, sends anAxisChangeEventto all registered listeners. As a side-effect, the auto-range flag is set tofalse(optional).- Parameters:
range- the range (excluding margins,nullnot permitted).turnOffAutoRange- a flag that controls whether or not the auto range is turned off.notify- a flag that controls whether or not listeners are notified.
-
setRangeWithMargins
public void setRangeWithMargins(double lower, double upper) Sets the axis range (after first adding the current margins to the range) and sends anAxisChangeEventto all registered listeners. As a side-effect, the auto-range flag is set tofalse.- Parameters:
lower- the lower axis limit.upper- the upper axis limit.
-
setRangeAboutValue
public void setRangeAboutValue(double value, double length) Sets the axis range, where the new range is 'size' in length, and centered on 'value'.- Parameters:
value- the central value.length- the range length.
-
isAutoTickUnitSelection
public boolean isAutoTickUnitSelection()Returns a flag indicating whether or not the tick unit is automatically selected from a range of standard tick units.- Returns:
- A flag indicating whether or not the tick unit is automatically selected.
- See Also:
-
setAutoTickUnitSelection
public void setAutoTickUnitSelection(boolean flag) Sets a flag indicating whether or not the tick unit is automatically selected from a range of standard tick units. If the flag is changed, registered listeners are notified that the chart has changed.- Parameters:
flag- the new value of the flag.- See Also:
-
setAutoTickUnitSelection
public void setAutoTickUnitSelection(boolean flag, boolean notify) Sets a flag indicating whether or not the tick unit is automatically selected from a range of standard tick units.- Parameters:
flag- the new value of the flag.notify- notify listeners?- See Also:
-
getStandardTickUnits
Returns the source for obtaining standard tick units for the axis.- Returns:
- The source (possibly
null). - See Also:
-
setStandardTickUnits
Sets the source for obtaining standard tick units for the axis and sends anAxisChangeEventto all registered listeners. The axis will try to select the smallest tick unit from the source that does not cause the tick labels to overlap (see also thesetAutoTickUnitSelection(boolean)method.- Parameters:
source- the source for standard tick units (nullpermitted).- See Also:
-
getMinorTickCount
public int getMinorTickCount()Returns the number of minor tick marks to display.- Returns:
- The number of minor tick marks to display.
- See Also:
-
setMinorTickCount
public void setMinorTickCount(int count) Sets the number of minor tick marks to display, and sends anAxisChangeEventto all registered listeners.- Parameters:
count- the count.- See Also:
-
valueToJava2D
Converts a data value to a coordinate in Java2D space, assuming that the axis runs along one edge of the specified dataArea.Note that it is possible for the coordinate to fall outside the area.
- Parameters:
value- the data value.area- the area for plotting the data.edge- the edge along which the axis lies.- Returns:
- The Java2D coordinate.
- See Also:
-
lengthToJava2D
Converts a length in data coordinates into the corresponding length in Java2D coordinates.- Parameters:
length- the length.area- the plot area.edge- the edge along which the axis lies.- Returns:
- The length in Java2D coordinates.
-
java2DToValue
Converts a coordinate in Java2D space to the corresponding data value, assuming that the axis runs along one edge of the specified dataArea.- Parameters:
java2DValue- the coordinate in Java2D space.area- the area in which the data is plotted.edge- the edge along which the axis lies.- Returns:
- The data value.
- See Also:
-
autoAdjustRange
protected abstract void autoAdjustRange()Automatically sets the axis range to fit the range of values in the dataset. Sometimes this can depend on the renderer used as well (for example, the renderer may "stack" values, requiring an axis range greater than otherwise necessary). -
centerRange
public void centerRange(double value) Centers the axis range about the specified value and sends anAxisChangeEventto all registered listeners.- Parameters:
value- the center value.
-
resizeRange
public void resizeRange(double percent) Increases or decreases the axis range by the specified percentage about the central value and sends anAxisChangeEventto 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).
- Parameters:
percent- the resize factor.- See Also:
-
resizeRange
public void resizeRange(double percent, double anchorValue) Increases or decreases the axis range by the specified percentage about the specified anchor value and sends anAxisChangeEventto 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).
- Parameters:
percent- the resize factor.anchorValue- the new central value after the resize.- See Also:
-
resizeRange2
public void resizeRange2(double percent, double anchorValue) Increases or decreases the axis range by the specified percentage about the specified anchor value and sends anAxisChangeEventto 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).
- Parameters:
percent- the resize factor.anchorValue- the new central value after the resize.- See Also:
-
zoomRange
public void zoomRange(double lowerPercent, double upperPercent) Zooms in on the current range.- Parameters:
lowerPercent- the new lower bound.upperPercent- the new upper bound.
-
pan
public void pan(double percent) Slides the axis range by the specified percentage.- Parameters:
percent- the percentage.
-
getAutoTickIndex
protected int getAutoTickIndex()Returns the auto tick index.- Returns:
- The auto tick index.
- See Also:
-
setAutoTickIndex
protected void setAutoTickIndex(int index) Sets the auto tick index.- Parameters:
index- the new value.- See Also:
-
equals
Tests the axis for equality with an arbitrary object. -
clone
Returns a clone of the object.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classAxis- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if some component of the axis does not support cloning.
-
writeObject
Provides serialization support.- Parameters:
stream- the output stream.- Throws:
IOException- if there is an I/O error.
-
readObject
Provides serialization support.- Parameters:
stream- the input stream.- Throws:
IOException- if there is an I/O error.ClassNotFoundException- if there is a classpath problem.
-