Class NumberAxis3D

All Implemented Interfaces:
Serializable, EventListener, Axis3D, ValueAxis3D, ChartElement, MarkerChangeListener

public class NumberAxis3D
extends AbstractValueAxis3D
implements ValueAxis3D, 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
  • Constructor Details

    • NumberAxis3D

      public NumberAxis3D​(String label)
      Creates a new axis with the specified label and default attributes.
      Parameters:
      label - the axis label (null permitted).
    • NumberAxis3D

      public NumberAxis3D​(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 Details

    • 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

      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

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

      public void setTickLabelFormatter​(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​(Graphics2D g2, Point2D pt0, Point2D pt1, Point2D opposingPt, 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​(Graphics2D g2, Point2D pt0, Point2D pt1, 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 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​(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.