com.orsoncharts.axis

## Class NumberAxis3D

- java.lang.Object
- - com.orsoncharts.axis.AbstractAxis3D
  - - com.orsoncharts.axis.AbstractValueAxis3D
    - - com.orsoncharts.axis.NumberAxis3D

- All Implemented Interfaces:
    Axis3D, ValueAxis3D, ChartElement, MarkerChangeListener, java.io.Serializable, java.util.EventListener

      public class NumberAxis3D
      extends AbstractValueAxis3D
      implements ValueAxis3D, java.io.Serializable

  A numerical axis for use with 3D plots (implements `ValueAxis3D`). In a `CategoryPlot3D` the value axis (the vertical one) is numerical, and in an `XYZPlot` all the axes (x, y and z) are numerical - for all these cases an instance of this class can be used.
  NOTE: This class is serializable, but the serialization format is subject to change in future releases and should not be relied upon for persisting instances of this class.
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from class com.orsoncharts.axis.AbstractValueAxis3D

      `range`

    - ### Fields inherited from class com.orsoncharts.axis.AbstractAxis3D

      `DEFAULT_LABEL_COLOR, DEFAULT_LABEL_FONT, DEFAULT_LABEL_OFFSET, DEFAULT_LINE_COLOR, DEFAULT_LINE_STROKE, DEFAULT_TICK_LABEL_COLOR, DEFAULT_TICK_LABEL_FONT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `NumberAxis3D(java.lang.String label)` Creates a new axis with the specified label and default attributes.
    `NumberAxis3D(java.lang.String label, Range range)` Creates a new axis with the specified label and range.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected Range` | `adjustedDataRange(Range range)` Adjusts the range by adding the lower and upper margins and taking into account also the `autoRangeStickyZero` flag.
    `void` | `draw(java.awt.Graphics2D g2, java.awt.geom.Point2D pt0, java.awt.geom.Point2D pt1, java.awt.geom.Point2D opposingPt, java.util.List<TickData> tickData, RenderingInfo info, boolean hinting)` Draws the axis to the supplied graphics target (`g2`, with the specified starting and ending points for the line.
    `boolean` | `equals(java.lang.Object obj)` Tests this instance for equality with an arbitrary object.
    `java.util.List<TickData>` | `generateTickData(double tickUnit)` Generates a list of tick data items for the specified tick unit.
    `boolean` | `getAutoRangeIncludesZero()` Returns the flag that determines whether or not the auto range mechanism should force zero to be included in the range.
    `boolean` | `getAutoRangeStickyZero()` Returns the flag that controls the behaviour of the auto range mechanism when zero falls into the axis margins.
    `java.text.Format` | `getTickLabelFormatter()` Returns the tick label formatter.
    `TickSelector` | `getTickSelector()` Returns the tick selector, an object that is responsible for choosing standard tick units for the axis.
    `double` | `getTickSize()` Returns the tick size (to be used when the tick selector is `null`).
    `int` | `hashCode()` Returns a hash code for this instance.
    `double` | `selectTick(java.awt.Graphics2D g2, java.awt.geom.Point2D pt0, java.awt.geom.Point2D pt1, java.awt.geom.Point2D opposingPt)` Selects a tick size that is appropriate for drawing the axis from `pt0` to `pt1`.
    `void` | `setAutoRangeIncludeZero(boolean include)` Sets the flag that controls whether or not the auto range mechanism should force zero to be included in the axis range, and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setAutoRangeStickyZero(boolean sticky)` Sets the flag that controls the behaviour of the auto range mechanism when zero falls into the axis margins.
    `void` | `setTickLabelFormatter(java.text.Format formatter)` Sets the formatter for the tick labels and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setTickSelector(TickSelector selector)` Sets the tick selector and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setTickSize(double tickSize)` Sets the tick size and sends an `Axis3DChangeEvent` to all registered listeners.
    `double` | `translateToWorld(double value, double length)` Converts a data value to world coordinates, taking into account the current axis range (assumes the world axis is zero-based and has the specified length).

    - ### Methods inherited from class com.orsoncharts.axis.AbstractValueAxis3D

      `axisStr, configureAsValueAxis, configureAsXAxis, configureAsYAxis, configureAsZAxis, generateMarkerData, getConfiguredType, getDefaultAutoRange, getLowerMargin, getMarker, getMarkers, getMinAutoRangeLength, getRange, getTickLabelFactor, getTickLabelOffset, getTickLabelOrientation, getTickMarkLength, getTickMarkPaint, getTickMarkStroke, getUpperMargin, isAutoAdjustRange, isInverted, receive, setAutoAdjustRange, setDefaultAutoRange, setInverted, setLowerMargin, setMarker, setMinAutoRangeLength, setRange, setRange, setTickLabelFactor, setTickLabelOffset, setTickLabelOrientation, setTickMarkLength, setTickMarkPaint, setTickMarkStroke, setUpperMargin, updateRange`

    - ### Methods inherited from class com.orsoncharts.axis.AbstractAxis3D

      `addChangeListener, drawAxisLabel, fireChangeEvent, getLabel, getLabelColor, getLabelFont, getLabelOffset, getLineColor, getLineStroke, getTickLabelColor, getTickLabelFont, getTickLabelsVisible, isVisible, markerChanged, notifyListeners, removeChangeListener, setLabel, setLabelColor, setLabelFont, setLabelOffset, setLineColor, setLineStroke, setTickLabelColor, setTickLabelFont, setTickLabelsVisible, setVisible`

    - ### Methods inherited from class java.lang.Object

      `clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface com.orsoncharts.axis.ValueAxis3D

      `configureAsValueAxis, configureAsXAxis, configureAsYAxis, configureAsZAxis, generateMarkerData, getConfiguredType, getMarker`

    - ### Methods inherited from interface com.orsoncharts.axis.Axis3D

      `addChangeListener, getLabelColor, getLabelFont, getRange, getTickLabelColor, getTickLabelFont, isInverted, isVisible, removeChangeListener, setInverted, setLabelColor, setLabelFont, setRange, setRange, setTickLabelColor, setTickLabelFont, setVisible`

    - ### Methods inherited from interface com.orsoncharts.ChartElement

      `receive`

- - ### Constructor Detail

    - #### NumberAxis3D

          public NumberAxis3D(java.lang.String label)

      Creates a new axis with the specified label and default attributes.
      Parameters:
        `label` - the axis label (`null` permitted).

    - #### NumberAxis3D

          public NumberAxis3D(java.lang.String label,
                              Range range)

      Creates a new axis with the specified label and range.
      Parameters:
        `label` - the axis label (`null` permitted).
        `range` - the range (`null` not permitted).

  - ### Method Detail

    - #### getAutoRangeIncludesZero

          public boolean getAutoRangeIncludesZero()

      Returns the flag that determines whether or not the auto range mechanism should force zero to be included in the range. The default value is `false`.
      Returns:
        A boolean.

    - #### setAutoRangeIncludeZero

          public void setAutoRangeIncludeZero(boolean include)

      Sets the flag that controls whether or not the auto range mechanism should force zero to be included in the axis range, and sends an `Axis3DChangeEvent` to all registered listeners.
      Parameters:
        `include` - the new flag value.

    - #### getAutoRangeStickyZero

          public boolean getAutoRangeStickyZero()

      Returns the flag that controls the behaviour of the auto range mechanism when zero falls into the axis margins. The default value is `true`.
      Returns:
        A boolean.
      See Also:
        `setAutoRangeStickyZero(boolean)`

    - #### setAutoRangeStickyZero

          public void setAutoRangeStickyZero(boolean sticky)

      Sets the flag that controls the behaviour of the auto range mechanism when zero falls into the axis margins. If `true`, when zero is in the axis margin the axis range is truncated at zero. If `false`, there is no special treatment.
      Parameters:
        `sticky` - the new flag value.

    - #### getTickSelector

          public TickSelector getTickSelector()

      Returns the tick selector, an object that is responsible for choosing standard tick units for the axis. The default value is a default instance of `NumberTickSelector`.
      Returns:
        The tick selector.
      See Also:
        `setTickSelector(TickSelector)`

    - #### setTickSelector

          public void setTickSelector(TickSelector selector)

      Sets the tick selector and sends an `Axis3DChangeEvent` to all registered listeners.
      Parameters:
        `selector` - the selector (`null` permitted).
      See Also:
        `getTickSelector()`

    - #### getTickSize

          public double getTickSize()

      Returns the tick size (to be used when the tick selector is `null`).
      Returns:
        The tick size.

    - #### setTickSize

          public void setTickSize(double tickSize)

      Sets the tick size and sends an `Axis3DChangeEvent` to all registered listeners.
      Parameters:
        `tickSize` - the new tick size.

    - #### getTickLabelFormatter

          public java.text.Format getTickLabelFormatter()

      Returns the tick label formatter. The default value is `DecimalFormat("0.00")`.
      Returns:
        The tick label formatter (never `null`).

    - #### setTickLabelFormatter

          public void setTickLabelFormatter(java.text.Format formatter)

      Sets the formatter for the tick labels and sends an `Axis3DChangeEvent` to all registered listeners.
      Parameters:
        `formatter` - the formatter (`null` not permitted).

    - #### adjustedDataRange

          protected Range adjustedDataRange(Range range)

      Adjusts the range by adding the lower and upper margins and taking into account also the `autoRangeStickyZero` flag.
      Specified by:
        `adjustedDataRange` in class `AbstractValueAxis3D`
      Parameters:
        `range` - the range (`null` not permitted).
      Returns:
        The adjusted range.

    - #### draw

          public void draw(java.awt.Graphics2D g2,
                           java.awt.geom.Point2D pt0,
                           java.awt.geom.Point2D pt1,
                           java.awt.geom.Point2D opposingPt,
                           java.util.List<TickData> tickData,
                           RenderingInfo info,
                           boolean hinting)

      Draws the axis to the supplied graphics target (`g2`, with the specified starting and ending points for the line. This method is used internally, you should not need to call it directly.
      Specified by:
        `draw` in interface `Axis3D`
      Specified by:
        `draw` in class `AbstractAxis3D`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `pt0` - the starting point (`null` not permitted).
        `pt1` - the ending point (`null` not permitted).
        `opposingPt` - an opposing point (to determine which side of the axis line the labels should appear, `null` not permitted).
        `tickData` - tick details (`null` not permitted).
        `info` - an object to be populated with rendering info (`null` permitted).
        `hinting` - perform element hinting?

    - #### translateToWorld

          public double translateToWorld(double value,
                                         double length)

      Converts a data value to world coordinates, taking into account the current axis range (assumes the world axis is zero-based and has the specified length).
      Specified by:
        `translateToWorld` in interface `Axis3D`
      Parameters:
        `value` - the data value (in axis units).
        `length` - the length of the (zero based) world axis.
      Returns:
        A world coordinate.

    - #### selectTick

          public double selectTick(java.awt.Graphics2D g2,
                                   java.awt.geom.Point2D pt0,
                                   java.awt.geom.Point2D pt1,
                                   java.awt.geom.Point2D opposingPt)

      Selects a tick size that is appropriate for drawing the axis from `pt0` to `pt1`.
      Specified by:
        `selectTick` in interface `ValueAxis3D`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `pt0` - the starting point for the axis.
        `pt1` - the ending point for the axis.
        `opposingPt` - a point on the opposite side of the line from where the labels should be drawn.
      Returns:
        The tick size.

    - #### generateTickData

          public java.util.List<TickData> generateTickData(double tickUnit)

      Generates a list of tick data items for the specified tick unit. This data will be passed to the 3D engine and will be updated with a 2D projection that can later be used to write the axis tick labels in the appropriate places.
      If `tickUnit` is `Double.NaN`, then tick data is generated for just the bounds of the axis.
      Specified by:
        `generateTickData` in interface `ValueAxis3D`
      Parameters:
        `tickUnit` - the tick unit.
      Returns:
        A list of tick data (never `null`).

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this instance for equality with an arbitrary object.
      Overrides:
        `equals` in class `AbstractValueAxis3D`
      Parameters:
        `obj` - the object to test against (`null` permitted).
      Returns:
        A boolean.

    - #### hashCode

          public int hashCode()

      Returns a hash code for this instance.
      Overrides:
        `hashCode` in class `AbstractAxis3D`
      Returns:
        A hash code.