org.jfree.chart.axis

Class ModuloAxis

Implemented Interfaces:
Cloneable, PublicCloneable, Serializable

public class ModuloAxis
extends NumberAxis

An axis that displays numerical values within a fixed range using a modulo calculation.

Field Summary

Fields inherited from class org.jfree.chart.axis.NumberAxis

DEFAULT_AUTO_RANGE_INCLUDES_ZERO, DEFAULT_AUTO_RANGE_STICKY_ZERO, DEFAULT_TICK_UNIT, DEFAULT_VERTICAL_TICK_LABELS

Fields inherited from class org.jfree.chart.axis.ValueAxis

DEFAULT_AUTO_RANGE, DEFAULT_AUTO_RANGE_MINIMUM_SIZE, DEFAULT_AUTO_TICK_UNIT_SELECTION, DEFAULT_INVERTED, DEFAULT_LOWER_BOUND, DEFAULT_LOWER_MARGIN, DEFAULT_RANGE, DEFAULT_UPPER_BOUND, DEFAULT_UPPER_MARGIN, MAXIMUM_TICK_COUNT

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_LABELS_VISIBLE, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_MARKS_VISIBLE, DEFAULT_TICK_MARK_INSIDE_LENGTH, DEFAULT_TICK_MARK_OUTSIDE_LENGTH, DEFAULT_TICK_MARK_PAINT, DEFAULT_TICK_MARK_STROKE

Constructor Summary

ModuloAxis(String label, Range fixedRange)
Creates a new axis.

Method Summary

protected void
autoAdjustRange()
This method should calculate a range that will show all the data values.
double
getDisplayEnd()
Returns the display end value.
double
getDisplayStart()
Returns the display start value.
double
java2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge)
Translates a Java2D coordinate into a data value.
double
lengthToJava2D(double length, Rectangle2D area, RectangleEdge edge)
Converts a length in data coordinates into the corresponding length in Java2D coordinates.
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
setDisplayRange(double start, double end)
Sets the display range.
double
valueToJava2D(double value, Rectangle2D area, RectangleEdge edge)
Translates a data value to a Java2D coordinate.

Methods inherited from class org.jfree.chart.axis.NumberAxis

autoAdjustRange, calculateHighestVisibleTickValue, calculateLowestVisibleTickValue, calculateVisibleTickCount, clone, configure, createIntegerTickUnits, createIntegerTickUnits, createStandardTickUnits, createStandardTickUnits, draw, equals, estimateMaximumTickLabelHeight, estimateMaximumTickLabelWidth, getAutoRangeIncludesZero, getAutoRangeStickyZero, getMarkerBand, getNumberFormatOverride, getRangeType, getTickUnit, hashCode, java2DToValue, refreshTicks, refreshTicksHorizontal, refreshTicksVertical, selectAutoTickUnit, selectHorizontalAutoTickUnit, selectVerticalAutoTickUnit, setAutoRangeIncludesZero, setAutoRangeStickyZero, setMarkerBand, setNumberFormatOverride, setRangeType, setTickUnit, setTickUnit, valueToJava2D

Methods inherited from class org.jfree.chart.axis.ValueAxis

autoAdjustRange, calculateAnchorPoint, centerRange, clone, drawAxisLine, drawTickMarksAndLabels, equals, findMaximumTickLabelHeight, findMaximumTickLabelWidth, getAutoRangeMinimumSize, getAutoTickIndex, getDefaultAutoRange, getDownArrow, getFixedAutoRange, getLeftArrow, getLowerBound, getLowerMargin, getRange, getRightArrow, getStandardTickUnits, getUpArrow, getUpperBound, getUpperMargin, isAutoRange, isAutoTickUnitSelection, isInverted, isNegativeArrowVisible, isPositiveArrowVisible, isVerticalTickLabels, java2DToValue, lengthToJava2D, reserveSpace, resizeRange, resizeRange, setAutoRange, setAutoRange, setAutoRangeMinimumSize, setAutoRangeMinimumSize, setAutoTickIndex, setAutoTickUnitSelection, setAutoTickUnitSelection, setDefaultAutoRange, setDownArrow, setFixedAutoRange, setInverted, setLeftArrow, setLowerBound, setLowerMargin, setNegativeArrowVisible, setPositiveArrowVisible, setRange, setRange, setRange, setRangeAboutValue, setRangeWithMargins, setRangeWithMargins, setRangeWithMargins, setRightArrow, setStandardTickUnits, setUpArrow, setUpperBound, setUpperMargin, setVerticalTickLabels, valueToJava2D, zoomRange

Methods inherited from class org.jfree.chart.axis.Axis

addChangeListener, clone, configure, draw, drawAxisLine, drawLabel, equals, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelEnclosure, getLabelFont, getLabelInsets, getLabelPaint, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, hasListener, isAxisLineVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, notifyListeners, refreshTicks, removeChangeListener, reserveSpace, setAxisLinePaint, setAxisLineStroke, setAxisLineVisible, setFixedDimension, setLabel, setLabelAngle, setLabelFont, setLabelInsets, setLabelPaint, setPlot, setTickLabelFont, setTickLabelInsets, setTickLabelPaint, setTickLabelsVisible, setTickMarkInsideLength, setTickMarkOutsideLength, setTickMarkPaint, setTickMarkStroke, setTickMarksVisible, setVisible

Constructor Details

ModuloAxis

public ModuloAxis(String label,
                  Range fixedRange)
Creates a new axis.
Parameters:
label - the axis label (null permitted).
fixedRange - the fixed range (null not permitted).

Method Details

autoAdjustRange

protected void autoAdjustRange()
This method should calculate a range that will show all the data values. For now, it just sets the axis range to the fixedRange.
Overrides:
autoAdjustRange in interface NumberAxis

getDisplayEnd

public double getDisplayEnd()
Returns the display end value.
Returns:
The display end value.

getDisplayStart

public double getDisplayStart()
Returns the display start value.
Returns:
The display start value.

java2DToValue

public double java2DToValue(double java2DValue,
                            Rectangle2D area,
                            RectangleEdge edge)
Translates a Java2D coordinate into a data value.
Overrides:
java2DToValue in interface NumberAxis
Parameters:
java2DValue - the Java2D coordinate.
area - the area.
edge - the edge.
Returns:
The Java2D coordinate.

lengthToJava2D

public double lengthToJava2D(double length,
                             Rectangle2D area,
                             RectangleEdge edge)
Converts a length in data coordinates into the corresponding length in Java2D coordinates.
Overrides:
lengthToJava2D in interface ValueAxis
Parameters:
length - the length.
area - the plot area.
edge - the edge along which the axis lies.
Returns:
The length in Java2D coordinates.

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

Overrides:
resizeRange in interface ValueAxis
Parameters:
percent - the resize factor.

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

Overrides:
resizeRange in interface ValueAxis
Parameters:
percent - the resize factor.
anchorValue - the new central value after the resize.

setDisplayRange

public void setDisplayRange(double start,
                            double end)
Sets the display range. The values will be mapped to the fixed range if necessary.
Parameters:
start - the start value.
end - the end value.

valueToJava2D

public double valueToJava2D(double value,
                            Rectangle2D area,
                            RectangleEdge edge)
Translates a data value to a Java2D coordinate.
Overrides:
valueToJava2D in interface NumberAxis
Parameters:
value - the value.
area - the area.
edge - the edge.
Returns:
A Java2D coordinate.