Package org.jfree.chart.axis
Class ModuloAxis
java.lang.Object
org.jfree.chart.axis.Axis
org.jfree.chart.axis.ValueAxis
org.jfree.chart.axis.NumberAxis
org.jfree.chart.axis.ModuloAxis
- All Implemented Interfaces:
Serializable,Cloneable,PublicCloneable
An axis that displays numerical values within a fixed range using a modulo
calculation.
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate doubleThe display end value.private doubleThe display start value (this will sometimes be > displayEnd, in which case the axis wraps around at some point in the middle of the axis).private RangeThe fixed range for the axis - all data values will be mapped to this range using a modulo calculation.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_LABELSFields 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_MARGIN, DEFAULT_RANGE, DEFAULT_UPPER_MARGIN, MAXIMUM_TICK_COUNTFields 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
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected voidThis method should calculate a range that will show all the data values.booleanTests this axis for equality with an arbitrary object.private doubleReturns the central value of the current display range.doubleReturns the display end value.private doubleReturns the display length for the axis.doubleReturns the display start value.doublejava2DToValue(double java2DValue, Rectangle2D area, RectangleEdge edge) Translates a Java2D coordinate into a data value.doublelengthToJava2D(double length, Rectangle2D area, RectangleEdge edge) Converts a length in data coordinates into the corresponding length in Java2D coordinates.private doublemapValueToFixedRange(double value) Maps a data value into the fixed range.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.voidsetDisplayRange(double start, double end) Sets the display range.private doubletrans(double value, Rectangle2D area, RectangleEdge edge) A regular translation from a data value to a Java2D value.private doubletransEnd(double value, Rectangle2D area, RectangleEdge edge, double length1, double length2) Translates a data value to a Java2D value for the second section of the axis.private doubletransStart(double value, Rectangle2D area, RectangleEdge edge, double length1, double length2) Translates a data value to a Java2D value for the first section of the axis.doublevalueToJava2D(double value, Rectangle2D area, RectangleEdge edge) Translates a data value to a Java2D coordinate.Methods inherited from class org.jfree.chart.axis.NumberAxis
calculateHighestVisibleTickValue, calculateLowestVisibleTickValue, calculateVisibleTickCount, clone, configure, createIntegerTickUnits, createIntegerTickUnits, createStandardTickUnits, createStandardTickUnits, draw, estimateMaximumTickLabelHeight, estimateMaximumTickLabelWidth, getAutoRangeIncludesZero, getAutoRangeStickyZero, getMarkerBand, getNumberFormatOverride, getRangeType, getTickUnit, hashCode, refreshTicks, refreshTicksHorizontal, refreshTicksVertical, selectAutoTickUnit, selectHorizontalAutoTickUnit, selectVerticalAutoTickUnit, setAutoRangeIncludesZero, setAutoRangeStickyZero, setMarkerBand, setNumberFormatOverride, setRangeType, setTickUnit, setTickUnitMethods inherited from class org.jfree.chart.axis.ValueAxis
calculateAnchorPoint, centerRange, 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, pan, reserveSpace, 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, setVerticalTickLabels, zoomRangeMethods inherited from class org.jfree.chart.axis.Axis
addChangeListener, createAndAddEntity, createAttributedLabel, drawAttributedLabel, drawLabel, fireChangeEvent, getAttributedLabel, getAxisLinePaint, getAxisLineStroke, getFixedDimension, getLabel, getLabelAngle, getLabelEnclosure, getLabelFont, getLabelInsets, getLabelLocation, getLabelPaint, getMinorTickMarkInsideLength, getMinorTickMarkOutsideLength, getPlot, getTickLabelFont, getTickLabelInsets, getTickLabelPaint, getTickMarkInsideLength, getTickMarkOutsideLength, getTickMarkPaint, getTickMarkStroke, hasListener, isAxisLineVisible, isMinorTickMarksVisible, isTickLabelsVisible, isTickMarksVisible, isVisible, labelAnchorH, labelAnchorV, labelLocationX, labelLocationY, notifyListeners, 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
-
fixedRange
The fixed range for the axis - all data values will be mapped to this range using a modulo calculation. -
displayStart
private double displayStartThe display start value (this will sometimes be > displayEnd, in which case the axis wraps around at some point in the middle of the axis). -
displayEnd
private double displayEndThe display end value.
-
-
Constructor Details
-
ModuloAxis
Creates a new axis.- Parameters:
label- the axis label (nullpermitted).fixedRange- the fixed range (nullnot permitted).
-
-
Method Details
-
getDisplayStart
public double getDisplayStart()Returns the display start value.- Returns:
- The display start value.
-
getDisplayEnd
public double getDisplayEnd()Returns the display end value.- Returns:
- The display end value.
-
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.
-
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:
autoAdjustRangein classNumberAxis
-
valueToJava2D
Translates a data value to a Java2D coordinate.- Overrides:
valueToJava2Din classNumberAxis- Parameters:
value- the value.area- the area.edge- the edge.- Returns:
- A Java2D coordinate.
- See Also:
-
trans
A regular translation from a data value to a Java2D value.- Parameters:
value- the value.area- the data area.edge- the edge along which the axis lies.- Returns:
- The Java2D coordinate.
-
transStart
private double transStart(double value, Rectangle2D area, RectangleEdge edge, double length1, double length2) Translates a data value to a Java2D value for the first section of the axis.- Parameters:
value- the value.area- the data area.edge- the edge along which the axis lies.length1- the length of the first section.length2- the length of the second section.- Returns:
- The Java2D coordinate.
-
transEnd
private double transEnd(double value, Rectangle2D area, RectangleEdge edge, double length1, double length2) Translates a data value to a Java2D value for the second section of the axis.- Parameters:
value- the value.area- the data area.edge- the edge along which the axis lies.length1- the length of the first section.length2- the length of the second section.- Returns:
- The Java2D coordinate.
-
mapValueToFixedRange
private double mapValueToFixedRange(double value) Maps a data value into the fixed range.- Parameters:
value- the value.- Returns:
- The mapped value.
-
java2DToValue
Translates a Java2D coordinate into a data value.- Overrides:
java2DToValuein classNumberAxis- Parameters:
java2DValue- the Java2D coordinate.area- the area.edge- the edge.- Returns:
- The Java2D coordinate.
- See Also:
-
getDisplayLength
private double getDisplayLength()Returns the display length for the axis.- Returns:
- The display length.
-
getDisplayCentralValue
private double getDisplayCentralValue()Returns the central value of the current display range.- Returns:
- The central 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).
- Overrides:
resizeRangein classValueAxis- 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).
- Overrides:
resizeRangein classValueAxis- Parameters:
percent- the resize factor.anchorValue- the new central value after the resize.- See Also:
-
lengthToJava2D
Converts a length in data coordinates into the corresponding length in Java2D coordinates.- Overrides:
lengthToJava2Din classValueAxis- Parameters:
length- the length.area- the plot area.edge- the edge along which the axis lies.- Returns:
- The length in Java2D coordinates.
-
equals
Tests this axis for equality with an arbitrary object.- Overrides:
equalsin classNumberAxis- Parameters:
obj- the object (nullpermitted).- Returns:
- A boolean.
-