Save This Page
Home » jcommon-1.0.13 » org.jfree » chart » axis » [javadoc | source]
org.jfree.chart.axis
public class: NumberAxis [javadoc | source]
java.lang.Object
   org.jfree.chart.axis.Axis
      org.jfree.chart.axis.ValueAxis
         org.jfree.chart.axis.NumberAxis

All Implemented Interfaces:
    Cloneable, Serializable, PublicCloneable

Direct Known Subclasses:
    NumberAxis3D, LogarithmicAxis, ModuloAxis, CyclicNumberAxis, SymbolicAxis, SymbolAxis

An axis for displaying 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.
Field Summary
public static final  boolean DEFAULT_AUTO_RANGE_INCLUDES_ZERO    The default value for the autoRangeIncludesZero flag. 
public static final  boolean DEFAULT_AUTO_RANGE_STICKY_ZERO    The default value for the autoRangeStickyZero flag. 
public static final  NumberTickUnit DEFAULT_TICK_UNIT    The default tick unit. 
public static final  boolean DEFAULT_VERTICAL_TICK_LABELS    The default setting for the vertical tick labels flag. 
Fields inherited from org.jfree.chart.axis.ValueAxis:
DEFAULT_RANGE,  DEFAULT_AUTO_RANGE,  DEFAULT_INVERTED,  DEFAULT_AUTO_RANGE_MINIMUM_SIZE,  DEFAULT_LOWER_MARGIN,  DEFAULT_UPPER_MARGIN,  DEFAULT_LOWER_BOUND,  DEFAULT_UPPER_BOUND,  DEFAULT_AUTO_TICK_UNIT_SELECTION,  MAXIMUM_TICK_COUNT
Fields inherited from org.jfree.chart.axis.Axis:
DEFAULT_AXIS_VISIBLE,  DEFAULT_AXIS_LABEL_FONT,  DEFAULT_AXIS_LABEL_PAINT,  DEFAULT_AXIS_LABEL_INSETS,  DEFAULT_AXIS_LINE_PAINT,  DEFAULT_AXIS_LINE_STROKE,  DEFAULT_TICK_LABELS_VISIBLE,  DEFAULT_TICK_LABEL_FONT,  DEFAULT_TICK_LABEL_PAINT,  DEFAULT_TICK_LABEL_INSETS,  DEFAULT_TICK_MARKS_VISIBLE,  DEFAULT_TICK_MARK_STROKE,  DEFAULT_TICK_MARK_PAINT,  DEFAULT_TICK_MARK_INSIDE_LENGTH,  DEFAULT_TICK_MARK_OUTSIDE_LENGTH
Constructor:
 public NumberAxis() 
 public NumberAxis(String label) 
    Constructs a number axis, using default values where necessary.
    Parameters:
    label - the axis label (null permitted).
Method from org.jfree.chart.axis.NumberAxis Summary:
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 from 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 from 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,   setLabelInsets,   setLabelPaint,   setPlot,   setTickLabelFont,   setTickLabelInsets,   setTickLabelPaint,   setTickLabelsVisible,   setTickMarkInsideLength,   setTickMarkOutsideLength,   setTickMarkPaint,   setTickMarkStroke,   setTickMarksVisible,   setVisible
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jfree.chart.axis.NumberAxis Detail:
 protected  void autoAdjustRange() 
    Rescales the axis to ensure that all data is visible.
 protected double calculateHighestVisibleTickValue() 
    Calculates the value of the highest visible tick on the axis.
 protected double calculateLowestVisibleTickValue() 
    Calculates the value of the lowest visible tick on the axis.
 protected int calculateVisibleTickCount() 
    Calculates the number of visible ticks.
 public Object clone() throws CloneNotSupportedException 
    Returns a clone of the axis.
 public  void configure() 
    Configures the axis to work with the specified plot. If the axis has auto-scaling, then sets the maximum and minimum values.
 public static TickUnitSource createIntegerTickUnits() 
    Returns a collection of tick units for integer values.
 public static TickUnitSource createIntegerTickUnits(Locale locale) 
    Returns a collection of tick units for integer values. Uses a given Locale to create the DecimalFormats.
 public static TickUnitSource createStandardTickUnits() 
    Creates the standard tick units.

    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 TickUnitSource createStandardTickUnits(Locale locale) 
    Creates a collection of standard tick units. The supplied locale is used to create the number formatter (a localised instance of NumberFormat).

    If you don't like these defaults, create your own instance of TickUnits and then pass it to the setStandardTickUnits() method.

 public AxisState draw(Graphics2D g2,
    double cursor,
    Rectangle2D plotArea,
    Rectangle2D dataArea,
    RectangleEdge edge,
    PlotRenderingInfo plotState) 
    Draws the axis on a Java 2D graphics device (such as the screen or a printer).
 public boolean equals(Object obj) 
    Tests the axis for equality with an arbitrary object.
 protected double estimateMaximumTickLabelHeight(Graphics2D g2) 
    Estimates the maximum tick label height.
 protected double estimateMaximumTickLabelWidth(Graphics2D g2,
    TickUnit unit) 
    Estimates the maximum width of the tick labels, assuming the specified tick unit is used.

    Rather than computing the string bounds of every tick on the axis, we just look at two values: the lower bound and the upper bound for the axis. These two values will usually be representative.

 public boolean getAutoRangeIncludesZero() 
    Returns the flag that indicates whether or not the automatic axis range (if indeed it is determined automatically) is forced to include zero.
 public boolean getAutoRangeStickyZero() 
    Returns a flag that affects the auto-range when zero falls outside the data range but inside the margins defined for the axis.
 public MarkerAxisBand getMarkerBand() 
    Returns the (optional) marker band for the axis.
 public NumberFormat getNumberFormatOverride() 
    Returns the number format override. If this is non-null, then it will be used to format the numbers on the axis.
 public RangeType getRangeType() 
    Returns the axis range type.
 public NumberTickUnit getTickUnit() 
    Returns the tick unit for the axis.

    Note: if the autoTickUnitSelection flag is true the tick unit may be changed while the axis is being drawn, so in that case the return value from this method may be irrelevant if the method is called before the axis has been drawn.

 public int hashCode() 
    Returns a hash code for this object.
 public 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.
 public List refreshTicks(Graphics2D g2,
    AxisState state,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).
 protected List refreshTicksHorizontal(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).
 protected List refreshTicksVertical(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Calculates the positions of the tick labels for the axis, storing the results in the tick label list (ready for drawing).
 protected  void selectAutoTickUnit(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Selects an appropriate tick value for the axis. The strategy is to display as many ticks as possible (selected from an array of 'standard' tick units) without the labels overlapping.
 protected  void selectHorizontalAutoTickUnit(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Selects an appropriate tick value for the axis. The strategy is to display as many ticks as possible (selected from an array of 'standard' tick units) without the labels overlapping.
 protected  void selectVerticalAutoTickUnit(Graphics2D g2,
    Rectangle2D dataArea,
    RectangleEdge edge) 
    Selects an appropriate tick value for the axis. The strategy is to display as many ticks as possible (selected from an array of 'standard' tick units) without the labels overlapping.
 public  void setAutoRangeIncludesZero(boolean flag) 
    Sets the flag that indicates whether or not the axis range, if automatically calculated, is forced to include zero.

    If the flag is changed to true, the axis range is recalculated.

    Any change to the flag will trigger an AxisChangeEvent .

 public  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.
 public  void setMarkerBand(MarkerAxisBand band) 
    Sets the marker band for the axis.

    The marker band is optional, leave it set to null if you don't require it.

 public  void setNumberFormatOverride(NumberFormat formatter) 
    Sets the number format override. If this is non-null, then it will be used to format the numbers on the axis.
 public  void setRangeType(RangeType rangeType) 
    Sets the axis range type.
 public  void setTickUnit(NumberTickUnit unit) 
 public  void setTickUnit(NumberTickUnit unit,
    boolean notify,
    boolean turnOffAutoSelect) 
 public 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 plotArea.