org.jfree.chart.axis

Class ValueAxis

public abstract class ValueAxis extends Axis implements Cloneable, PublicCloneable, Serializable

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.
Field Summary
static booleanDEFAULT_AUTO_RANGE
The default auto-range value.
static doubleDEFAULT_AUTO_RANGE_MINIMUM_SIZE
The default minimum auto range.
static booleanDEFAULT_AUTO_TICK_UNIT_SELECTION
The default auto-tick-unit-selection value.
static booleanDEFAULT_INVERTED
The default inverted flag setting.
static doubleDEFAULT_LOWER_BOUND
The default lower bound for the axis.
static doubleDEFAULT_LOWER_MARGIN
The default value for the lower margin (0.05 = 5%).
static RangeDEFAULT_RANGE
The default axis range.
static doubleDEFAULT_UPPER_BOUND
The default upper bound for the axis.
static doubleDEFAULT_UPPER_MARGIN
The default value for the upper margin (0.05 = 5%).
static intMAXIMUM_TICK_COUNT
The maximum tick count.
Constructor Summary
protected ValueAxis(String label, TickUnitSource standardTickUnits)
Constructs a value axis.
Method Summary
protected abstract voidautoAdjustRange()
Automatically 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 an AxisChangeEvent to all registered listeners.
Objectclone()
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.
booleanequals(Object obj)
Tests 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.
doublegetAutoRangeMinimumSize()
Returns the minimum size allowed for the axis range when it is automatically calculated.
protected intgetAutoTickIndex()
Returns the auto tick index.
RangegetDefaultAutoRange()
Returns the default auto range.
ShapegetDownArrow()
Returns a shape that can be displayed as an arrow pointing downwards at the end of an axis line.
doublegetFixedAutoRange()
Returns the fixed auto range.
ShapegetLeftArrow()
Returns a shape that can be displayed as an arrow pointing left at the end of an axis line.
doublegetLowerBound()
Returns the lower bound of the axis range.
doublegetLowerMargin()
Returns the lower margin for the axis, expressed as a percentage of the axis range.
intgetMinorTickCount()
Returns the number of minor tick marks to display.
RangegetRange()
Returns the range for the axis.
ShapegetRightArrow()
Returns a shape that can be displayed as an arrow pointing right at the end of an axis line.
TickUnitSourcegetStandardTickUnits()
Returns the source for obtaining standard tick units for the axis.
ShapegetUpArrow()
Returns a shape that can be displayed as an arrow pointing upwards at the end of an axis line.
doublegetUpperBound()
Returns the upper bound for the axis range.
doublegetUpperMargin()
Returns the upper margin for the axis, expressed as a percentage of the axis range.
booleanisAutoRange()
Returns the flag that controls whether or not the axis range is automatically adjusted to fit the data values.
booleanisAutoTickUnitSelection()
Returns a flag indicating whether or not the tick unit is automatically selected from a range of standard tick units.
booleanisInverted()
Returns a flag that controls the direction of values on the axis.
booleanisNegativeArrowVisible()
Returns a flag that controls whether or not the axis line has an arrow drawn that points in the negative direction for the axis.
booleanisPositiveArrowVisible()
Returns a flag that controls whether or not the axis line has an arrow drawn that points in the positive direction for the axis.
booleanisVerticalTickLabels()
Returns true if the tick labels should be rotated (to vertical), and false otherwise.
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.
AxisSpacereserveSpace(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 an AxisChangeEvent to 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 an AxisChangeEvent to 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 an AxisChangeEvent to 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 an AxisChangeEvent to 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 an AxisChangeEvent to 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 an AxisChangeEvent to 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 an AxisChangeEvent to 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 an AxisChangeEvent to all registered listeners.
voidsetMinorTickCount(int count)
Sets the number of minor tick marks to display, and sends an AxisChangeEvent to 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 an AxisChangeEvent to 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 an AxisChangeEvent to all registered listeners.
voidsetRange(Range range)
Sets the range attribute and sends an AxisChangeEvent to all registered listeners.
voidsetRange(Range range, boolean turnOffAutoRange, boolean notify)
Sets the range for the axis, if requested, sends an AxisChangeEvent to all registered listeners.
voidsetRange(double lower, double upper)
Sets the axis range and sends an AxisChangeEvent 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(Range range)
Sets the range for the axis (after first adding the current margins to the specified range) and sends an AxisChangeEvent to 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 an AxisChangeEvent to all registered listeners.
voidsetRangeWithMargins(double lower, double upper)
Sets the axis range (after first adding the current margins to the range) and sends an AxisChangeEvent to 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 an AxisChangeEvent to all registered listeners.
voidsetStandardTickUnits(TickUnitSource source)
Sets the source for obtaining standard tick units for the axis and sends an AxisChangeEvent to 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 an AxisChangeEvent to all registered listeners.
voidsetUpperBound(double max)
Sets the upper bound for the axis range, and sends an AxisChangeEvent to all registered listeners.
voidsetUpperMargin(double margin)
Sets the upper margin for the axis (as a percentage of the axis range) and sends an AxisChangeEvent to 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.
voidzoomRange(double lowerPercent, double upperPercent)
Zooms in on the current range.

Field Detail

DEFAULT_AUTO_RANGE

public static final boolean DEFAULT_AUTO_RANGE
The default auto-range value.

DEFAULT_AUTO_RANGE_MINIMUM_SIZE

public static final double DEFAULT_AUTO_RANGE_MINIMUM_SIZE
The default minimum auto range.

DEFAULT_AUTO_TICK_UNIT_SELECTION

public static final boolean DEFAULT_AUTO_TICK_UNIT_SELECTION
The default auto-tick-unit-selection value.

DEFAULT_INVERTED

public static final boolean DEFAULT_INVERTED
The default inverted flag setting.

DEFAULT_LOWER_BOUND

public static final double DEFAULT_LOWER_BOUND

Deprecated: From 1.0.5 onwards, the axis defines a defaultRange attribute (see getDefaultAutoRange).

The default lower bound for the axis.

DEFAULT_LOWER_MARGIN

public static final double DEFAULT_LOWER_MARGIN
The default value for the lower margin (0.05 = 5%).

DEFAULT_RANGE

public static final Range DEFAULT_RANGE
The default axis range.

DEFAULT_UPPER_BOUND

public static final double DEFAULT_UPPER_BOUND

Deprecated: From 1.0.5 onwards, the axis defines a defaultRange attribute (see getDefaultAutoRange).

The default upper bound for the axis.

DEFAULT_UPPER_MARGIN

public static final double DEFAULT_UPPER_MARGIN
The default value for the upper margin (0.05 = 5%).

MAXIMUM_TICK_COUNT

public static final int MAXIMUM_TICK_COUNT
The maximum tick count.

Constructor Detail

ValueAxis

protected ValueAxis(String label, TickUnitSource standardTickUnits)
Constructs a value axis.

Parameters: label the axis label (null permitted). standardTickUnits the source for standard tick units (null permitted).

Method Detail

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).

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.

centerRange

public void centerRange(double value)
Centers the axis range about the specified value and sends an AxisChangeEvent to all registered listeners.

Parameters: value the center value.

clone

public Object clone()
Returns a clone of the object.

Returns: A clone.

Throws: CloneNotSupportedException if some component of the axis does not support cloning.

drawAxisLine

protected void drawAxisLine(Graphics2D g2, double cursor, Rectangle2D dataArea, RectangleEdge edge)
Draws an axis line at the current cursor position and edge.

Parameters: g2 the graphics device. cursor the cursor position. dataArea the data area. edge the edge.

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. cursor the cursor. plotArea the plot area. dataArea the data area. edge the edge that the axis is aligned with.

Returns: The width or height used to draw the axis.

equals

public boolean equals(Object obj)
Tests the axis for equality with an arbitrary object.

Parameters: obj the object (null permitted).

Returns: true or false.

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.

getAutoRangeMinimumSize

public double getAutoRangeMinimumSize()
Returns the minimum size allowed for the axis range when it is automatically calculated.

Returns: The minimum range.

See Also: ValueAxis

getAutoTickIndex

protected int getAutoTickIndex()
Returns the auto tick index.

Returns: The auto tick index.

See Also: ValueAxis

getDefaultAutoRange

public Range getDefaultAutoRange()
Returns the default auto range.

Returns: The default auto range (never null).

Since: 1.0.5

See Also:

getDownArrow

public Shape 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

getFixedAutoRange

public double getFixedAutoRange()
Returns the fixed auto range.

Returns: The length.

See Also: ValueAxis

getLeftArrow

public Shape 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

getLowerBound

public double getLowerBound()
Returns the lower bound of the axis range.

Returns: The lower bound.

See Also: ValueAxis

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: ValueAxis

getMinorTickCount

public int getMinorTickCount()
Returns the number of minor tick marks to display.

Returns: The number of minor tick marks to display.

Since: 1.0.12

See Also:

getRange

public Range getRange()
Returns the range for the axis.

Returns: The axis range (never null).

See Also: setRange

getRightArrow

public Shape 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

getStandardTickUnits

public TickUnitSource getStandardTickUnits()
Returns the source for obtaining standard tick units for the axis.

Returns: The source (possibly null).

See Also: setStandardTickUnits

getUpArrow

public Shape 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

getUpperBound

public double getUpperBound()
Returns the upper bound for the axis range.

Returns: The upper bound.

See Also: ValueAxis

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: ValueAxis

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: ValueAxis

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: ValueAxis

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: ValueAxis

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: ValueAxis

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: ValueAxis

isVerticalTickLabels

public boolean isVerticalTickLabels()
Returns true if the tick labels should be rotated (to vertical), and false otherwise.

Returns: true or false.

See Also: ValueAxis

java2DToValue

public abstract double java2DToValue(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.

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: ValueAxis

lengthToJava2D

public double lengthToJava2D(double length, Rectangle2D area, RectangleEdge edge)
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.

pan

public void pan(double percent)
Slides the axis range by the specified percentage.

Parameters: percent the percentage.

Since: 1.0.13

reserveSpace

public AxisSpace reserveSpace(Graphics2D g2, Plot plot, Rectangle2D plotArea, RectangleEdge edge, AxisSpace space)
Returns the space required to draw the axis.

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).

resizeRange

public 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.

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: ValueAxis

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 an 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).

Parameters: percent the resize factor. anchorValue the new central value after the resize.

See Also: ValueAxis

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 an 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).

Parameters: percent the resize factor. anchorValue the new central value after the resize.

Since: 1.0.13

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: isAutoRange

setAutoRange

protected void setAutoRange(boolean auto, boolean notify)
Sets the auto range attribute. If the notify flag is set, an AxisChangeEvent is sent to registered listeners.

Parameters: auto the flag. notify notify listeners?

See Also: isAutoRange

setAutoRangeMinimumSize

public void setAutoRangeMinimumSize(double size)
Sets the auto range minimum size and sends an AxisChangeEvent to all registered listeners.

Parameters: size the size.

See Also: getAutoRangeMinimumSize

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 AxisChangeEvent is forwarded to all registered listeners.

Parameters: size the new minimum. notify notify listeners?

setAutoTickIndex

protected void setAutoTickIndex(int index)
Sets the auto tick index.

Parameters: index the new value.

See Also: getAutoTickIndex

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: isAutoTickUnitSelection

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: isAutoTickUnitSelection

setDefaultAutoRange

public void setDefaultAutoRange(Range range)
Sets the default auto range and sends an AxisChangeEvent to all registered listeners.

Parameters: range the range (null not permitted).

Since: 1.0.5

See Also:

setDownArrow

public void setDownArrow(Shape arrow)
Sets the shape that can be displayed as an arrow pointing downwards at the end of an axis line and sends an AxisChangeEvent to all registered listeners.

Parameters: arrow the arrow shape (null not permitted).

See Also: getDownArrow

setFixedAutoRange

public void setFixedAutoRange(double length)
Sets the fixed auto range for the axis.

Parameters: length the range length.

See Also: getFixedAutoRange

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: isInverted

setLeftArrow

public void setLeftArrow(Shape arrow)
Sets the shape that can be displayed as an arrow pointing left at the end of an axis line and sends an AxisChangeEvent to all registered listeners.

Parameters: arrow the arrow shape (null not permitted).

See Also: getLeftArrow

setLowerBound

public void setLowerBound(double min)
Sets the lower bound for the axis range. An AxisChangeEvent is sent to all registered listeners.

Parameters: min the new minimum.

See Also: getLowerBound

setLowerMargin

public void setLowerMargin(double margin)
Sets the lower margin for the axis (as a percentage of the axis range) and sends an AxisChangeEvent to 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: getLowerMargin ValueAxis

setMinorTickCount

public void setMinorTickCount(int count)
Sets the number of minor tick marks to display, and sends an AxisChangeEvent to all registered listeners.

Parameters: count the count.

Since: 1.0.12

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 an AxisChangeEvent to all registered listeners.

Parameters: visible the flag.

See Also: ValueAxis

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 an AxisChangeEvent to all registered listeners.

Parameters: visible the flag.

See Also: isPositiveArrowVisible

setRange

public void setRange(Range range)
Sets the range attribute and sends an AxisChangeEvent to all registered listeners. As a side-effect, the auto-range flag is set to false.

Parameters: range the range (null not permitted).

See Also: getRange

setRange

public void setRange(Range range, boolean turnOffAutoRange, boolean notify)
Sets the range for the axis, if requested, sends an AxisChangeEvent to all registered listeners. As a side-effect, the auto-range flag is set to false (optional).

Parameters: range the range (null not 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: getRange

setRange

public void setRange(double lower, double upper)
Sets the axis range and sends an AxisChangeEvent to all registered listeners. As a side-effect, the auto-range flag is set to false.

Parameters: lower the lower axis limit. upper the upper axis limit.

See Also: getRange setRange

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.

setRangeWithMargins

public void setRangeWithMargins(Range range)
Sets the range for the axis (after first adding the current margins to the specified range) and sends an AxisChangeEvent to all registered listeners.

Parameters: range the range (null not permitted).

setRangeWithMargins

public void setRangeWithMargins(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 an AxisChangeEvent to all registered listeners. As a side-effect, the auto-range flag is set to false (optional).

Parameters: range the range (excluding margins, null not 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 an AxisChangeEvent to all registered listeners. As a side-effect, the auto-range flag is set to false.

Parameters: lower the lower axis limit. upper the upper axis limit.

setRightArrow

public void setRightArrow(Shape arrow)
Sets the shape that can be displayed as an arrow pointing rightwards at the end of an axis line and sends an AxisChangeEvent to all registered listeners.

Parameters: arrow the arrow shape (null not permitted).

See Also: getRightArrow

setStandardTickUnits

public void setStandardTickUnits(TickUnitSource source)
Sets the source for obtaining standard tick units for the axis and sends an AxisChangeEvent to 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 the ValueAxis method.

Parameters: source the source for standard tick units (null permitted).

See Also: getStandardTickUnits

setUpArrow

public void setUpArrow(Shape arrow)
Sets the shape that can be displayed as an arrow pointing upwards at the end of an axis line and sends an AxisChangeEvent to all registered listeners.

Parameters: arrow the arrow shape (null not permitted).

See Also: getUpArrow

setUpperBound

public void setUpperBound(double max)
Sets the upper bound for the axis range, and sends an AxisChangeEvent to all registered listeners.

Parameters: max the new maximum.

See Also: getUpperBound

setUpperMargin

public void setUpperMargin(double margin)
Sets the upper margin for the axis (as a percentage of the axis range) and sends an AxisChangeEvent to 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: getLowerMargin ValueAxis

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, an AxisChangeEvent is sent to all registered listeners.

Parameters: flag the flag.

See Also: isVerticalTickLabels

valueToJava2D

public abstract double valueToJava2D(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.

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: ValueAxis

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.

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.