|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.jrefinery.chart.Axis | +--com.jrefinery.chart.ValueAxis | +--com.jrefinery.chart.NumberAxis
The base class for axes that display numerical data.
If the axis is set up to automatically determine its range to fit the data, you can ensure that the range includes zero (statisticians usually prefer this) by setting the autoRangeIncludesZero flag to true.
The NumberAxis class has a mechanism for automatically selecting a tick unit that is appropriate for the current axis range. This mechanism is an adaptation of code suggested by Laurence Vanhelsuwe.
HorizontalNumberAxis
,
VerticalNumberAxis
Field Summary | |
static boolean |
DEFAULT_AUTO_RANGE_INCLUDES_ZERO
The default value for the autoRangeIncludesZero flag. |
static boolean |
DEFAULT_AUTO_RANGE_STICKY_ZERO
The default value for the autoRangeStickyZero flag. |
static NumberTickUnit |
DEFAULT_TICK_UNIT
The default tick unit. |
Fields inherited from class com.jrefinery.chart.ValueAxis |
DEFAULT_AUTO_RANGE, DEFAULT_AUTO_RANGE_MINIMUM_SIZE, DEFAULT_CROSSHAIR_PAINT, DEFAULT_CROSSHAIR_STROKE, DEFAULT_CROSSHAIR_VISIBLE, DEFAULT_GRID_LINE_PAINT, DEFAULT_GRID_LINE_STROKE, DEFAULT_LOWER_BOUND, DEFAULT_LOWER_MARGIN, DEFAULT_RANGE, DEFAULT_UPPER_BOUND, DEFAULT_UPPER_MARGIN, MAXIMUM_TICK_COUNT |
Fields inherited from class com.jrefinery.chart.Axis |
fixedDimension, label, labelFont, labelInsets, labelPaint, plot, tickLabelFont, tickLabelInsets, tickLabelPaint, tickLabelsVisible, tickMarkPaint, tickMarkStroke, tickMarksVisible, ticks, visible |
Fields inherited from interface com.jrefinery.chart.AxisConstants |
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_PAINT, DEFAULT_TICK_STROKE |
Constructor Summary | |
protected |
NumberAxis(java.lang.String label)
Constructs a number axis, using default values where necessary. |
protected |
NumberAxis(java.lang.String label,
java.awt.Font labelFont,
java.awt.Paint labelPaint,
java.awt.Insets labelInsets,
boolean tickLabelsVisible,
java.awt.Font tickLabelFont,
java.awt.Paint tickLabelPaint,
java.awt.Insets tickLabelInsets,
boolean tickMarksVisible,
java.awt.Stroke tickMarkStroke,
java.awt.Paint tickMarkPaint,
boolean autoRange,
java.lang.Number autoRangeMinimumSize,
boolean autoRangeIncludesZero,
boolean autoRangeStickyZero,
double lowerBound,
double upperBound,
boolean inverted,
boolean autoTickUnitSelection,
NumberTickUnit tickUnit,
boolean gridLinesVisible,
java.awt.Stroke gridStroke,
java.awt.Paint gridPaint,
double anchorValue,
boolean crosshairVisible,
double crosshairValue,
java.awt.Stroke crosshairStroke,
java.awt.Paint crosshairPaint)
Constructs a number axis. |
Method Summary | |
boolean |
autoRangeIncludesZero()
Returns the flag that indicates whether or not the automatic axis range (if indeed it is determined automatically) is forced to include zero. |
boolean |
autoRangeStickyZero()
Returns a flag that affects the auto-range when zero falls outside the data range but inside the margins defined for the axis. |
double |
calculateHighestVisibleTickValue()
Calculates the value of the highest visible tick on the axis. |
double |
calculateLowestVisibleTickValue()
Calculates the value of the lowest visible tick on the axis. |
int |
calculateVisibleTickCount()
Calculates the number of visible ticks. |
static TickUnits |
createIntegerTickUnits()
Returns a collection of tick units for integer values. |
static TickUnits |
createIntegerTickUnits(java.util.Locale locale)
Returns a collection of tick units for integer values. |
static TickUnits |
createStandardTickUnits()
Creates the standard tick units. |
static TickUnits |
createStandardTickUnits(java.util.Locale locale)
Creates the standard tick units, and uses a given Locale to create the DecimalFormats |
NumberTickUnit |
getTickUnit()
Returns the tick unit for the axis. |
boolean |
isInverted()
Returns a flag that controls the direction of values on the axis. |
void |
setAutoRangeIncludesZero(boolean flag)
Sets the flag that indicates whether or not the automatic axis range is forced to include zero. |
void |
setAutoRangeStickyZero(boolean flag)
Sets a flag that affects the auto-range when zero falls outside the data range but inside the margins defined for the axis. |
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. |
void |
setTickUnit(NumberTickUnit unit)
Sets a fixed tick unit for the axis, and notifies registered listeners that the axis has been changed. |
protected void |
setTickUnitAttribute(NumberTickUnit unit)
Sets the tick unit attribute without any other side effects. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final boolean DEFAULT_AUTO_RANGE_INCLUDES_ZERO
public static final boolean DEFAULT_AUTO_RANGE_STICKY_ZERO
public static final NumberTickUnit DEFAULT_TICK_UNIT
Constructor Detail |
protected NumberAxis(java.lang.String label)
label
- the axis label.protected NumberAxis(java.lang.String label, java.awt.Font labelFont, java.awt.Paint labelPaint, java.awt.Insets labelInsets, boolean tickLabelsVisible, java.awt.Font tickLabelFont, java.awt.Paint tickLabelPaint, java.awt.Insets tickLabelInsets, boolean tickMarksVisible, java.awt.Stroke tickMarkStroke, java.awt.Paint tickMarkPaint, boolean autoRange, java.lang.Number autoRangeMinimumSize, boolean autoRangeIncludesZero, boolean autoRangeStickyZero, double lowerBound, double upperBound, boolean inverted, boolean autoTickUnitSelection, NumberTickUnit tickUnit, boolean gridLinesVisible, java.awt.Stroke gridStroke, java.awt.Paint gridPaint, double anchorValue, boolean crosshairVisible, double crosshairValue, java.awt.Stroke crosshairStroke, java.awt.Paint crosshairPaint)
label
- the axis label.labelFont
- the font for displaying the axis label.labelPaint
- the paint used to display the axis label.labelInsets
- the amount of blank space around the axis label.tickLabelsVisible
- flag indicating whether or not the tick labels are visible.tickLabelFont
- the font used to display the tick labels.tickLabelPaint
- the paint used to draw the tick labels.tickLabelInsets
- the amount of blank space around the tick labels.tickMarksVisible
- flag indicating whether or not tick marks are visible.tickMarkStroke
- the stroke used to draw the tick marks (if visible).tickMarkPaint
- the paint used to draw the tick marks (if visible).autoRange
- flag indicating whether or not the axis range is automatically determined.autoRangeMinimumSize
- the smallest range allowed when the axis range is calculated to
fit the data.autoRangeIncludesZero
- a flag indicating whether the auto range must include zero.autoRangeStickyZero
- a flag controlling the axis margins around zero.lowerBound
- the lowest value shown on the axis.upperBound
- the highest value shown on the axis.inverted
- a flag indicating whether the axis is normal or inverted (inverted means
running from positive to negative).autoTickUnitSelection
- a flag indicating whether or not the tick value is
automatically selected.tickUnit
- the tick unit for the axis.gridLinesVisible
- flag indicating whether or not grid lines are visible.gridStroke
- the pen/brush used to display grid lines (if visible).gridPaint
- the color used to display grid lines (if visible).anchorValue
- the anchor value.crosshairVisible
- whether to show a crosshair.crosshairValue
- the value at which to draw the crosshair line (null permitted).crosshairStroke
- the pen/brush used to draw the data line.crosshairPaint
- the color used to draw the data line.Method Detail |
public boolean isInverted()
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.
public void setInverted(boolean flag)
flag
- the flag.public boolean autoRangeIncludesZero()
public void setAutoRangeIncludesZero(boolean flag)
flag
- the new value of the flag.public boolean autoRangeStickyZero()
public void setAutoRangeStickyZero(boolean flag)
flag
- The new flag.public NumberTickUnit getTickUnit()
public void setTickUnit(NumberTickUnit unit)
This method also sets the autoTickUnitSelection flag to false.
unit
- The new tick unit.protected void setTickUnitAttribute(NumberTickUnit unit)
unit
- the new tick unit.public double calculateLowestVisibleTickValue()
public double calculateHighestVisibleTickValue()
public int calculateVisibleTickCount()
public static TickUnits createStandardTickUnits()
If you don't like these defaults, create your own instance of TickUnits and then pass it to the setStandardTickUnits(...) method in the NumberAxis class.
public static TickUnits createIntegerTickUnits()
public static TickUnits createStandardTickUnits(java.util.Locale locale)
If you don't like these defaults, create your own instance of TickUnits and then pass it to the setStandardTickUnits(...) method in the NumberAxis class.
locale
- the locale to use to represent Numbers.public static TickUnits createIntegerTickUnits(java.util.Locale locale)
locale
- the locale to use to represent Numbers.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |