|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||
java.lang.Objectcom.jrefinery.chart.Axis
com.jrefinery.chart.ValueAxis
com.jrefinery.chart.NumberAxis
public abstract class 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 | |
|---|---|
protected boolean |
autoRangeIncludesZero
A flag that affects the axis range when the range is determined automatically. |
protected java.lang.Number |
autoRangeMinimumSize
The minimum size of a range that is determined automatically. |
protected boolean |
autoRangeStickyZero
A flag that affects the size of the margins added to the axis range when the range is determined automatically. |
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 double |
DEFAULT_LOWER_MARGIN
The default value for the lower margin (0.05 = 5%). |
static java.lang.Number |
DEFAULT_MINIMUM_AUTO_RANGE
The default minimum auto range. |
static NumberTickUnit |
DEFAULT_TICK_UNIT
The default tick unit. |
static double |
DEFAULT_UPPER_MARGIN
The default value for the upper margin (0.05 = 5%). |
protected boolean |
inverted
A flag that affects the orientation of the values on the axis. |
protected double |
lowerMargin
The lower margin. |
protected TickUnits |
standardTickUnits
The standard tick units for the axis. |
protected NumberTickUnit |
tickUnit
The tick unit for the axis. |
protected double |
upperMargin
The upper margin. |
| Fields inherited from class com.jrefinery.chart.Axis |
|---|
fixedDimension, label, labelFont, labelInsets, labelPaint, listeners, plot, tickLabelFont, tickLabelInsets, tickLabelPaint, tickLabelsVisible, 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_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,
boolean autoRange,
boolean autoRangeIncludesZero,
boolean autoRangeStickyZero,
java.lang.Number autoRangeMinimumSize,
double minimumAxisValue,
double maximumAxisValue,
boolean inverted,
boolean autoTickUnitSelection,
NumberTickUnit tickUnit,
boolean gridLinesVisible,
java.awt.Stroke gridStroke,
java.awt.Paint gridPaint,
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. |
java.lang.Number |
getAutoRangeMinimumSize()
Returns the minimum size of the automatic axis range (if indeed it is determined automatically). |
double |
getLowerMargin()
Returns the margin (as a percentage of the range) by which the minimum axis value is less than the minimum data value. |
TickUnits |
getStandardTickUnits()
Returns the standard tick units for the axis. |
NumberTickUnit |
getTickUnit()
Returns the tick unit for the axis. |
double |
getUpperMargin()
Returns the margin (as a percentage of the range) by which the maximum axis value exceeds the maximum data value. |
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 |
setAutoRangeMinimumSize(java.lang.Number size)
Sets the minimum size of the automatic axis range. |
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 |
setLowerMargin(double margin)
Sets the lower margin. |
void |
setStandardTickUnits(TickUnits collection)
Sets the collection of tick units for 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. |
void |
setUpperMargin(double margin)
Sets the upper margin. |
| 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 double DEFAULT_UPPER_MARGIN
public static final double DEFAULT_LOWER_MARGIN
public static final java.lang.Number DEFAULT_MINIMUM_AUTO_RANGE
public static final NumberTickUnit DEFAULT_TICK_UNIT
protected boolean inverted
protected boolean autoRangeIncludesZero
protected boolean autoRangeStickyZero
protected java.lang.Number autoRangeMinimumSize
protected double upperMargin
protected double lowerMargin
protected NumberTickUnit tickUnit
protected TickUnits standardTickUnits
| 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,
boolean autoRange,
boolean autoRangeIncludesZero,
boolean autoRangeStickyZero,
java.lang.Number autoRangeMinimumSize,
double minimumAxisValue,
double maximumAxisValue,
boolean inverted,
boolean autoTickUnitSelection,
NumberTickUnit tickUnit,
boolean gridLinesVisible,
java.awt.Stroke gridStroke,
java.awt.Paint gridPaint,
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);autoRange - Flag indicating whether or not the axis range is automatically determined.autoRangeIncludesZero - A flag indicating whether the auto range must include zero.autoRangeStickyZero - A flag controlling the axis margins around zero.autoRangeMinimumSize - The minimum size for the auto range.minimumAxisValue - The lowest value shown on the axis.maximumAxisValue - 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).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 java.lang.Number getAutoRangeMinimumSize()
public void setAutoRangeMinimumSize(java.lang.Number size)
minimum - The new minimum.public double getUpperMargin()
public void setUpperMargin(double margin)
margin - The new margin.public double getLowerMargin()
public void setLowerMargin(double margin)
margin - The new margin.public TickUnits getStandardTickUnits()
If autoTickUnitSelection is on, the tick unit for the axis will be automatically selected from this collection.
public void setStandardTickUnits(TickUnits collection)
If the autoTickUnitSelection flag is true, a tick unit will be selected from this collection automatically (to ensure that labels do not overlap).
collection - The tick unit collection.public NumberTickUnit getTickUnit()
public void setTickUnit(NumberTickUnit unit)
This method also sets the autoTickUnitSelection flag to false.
unit - The new tick unit.public double calculateLowestVisibleTickValue()
public double calculateHighestVisibleTickValue()
public int calculateVisibleTickCount()
|
||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||