com.orsoncharts.axis

## Class AbstractAxis3D

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

- All Implemented Interfaces:
    Axis3D, ChartElement, MarkerChangeListener, java.io.Serializable, java.util.EventListener
  Direct Known Subclasses:
    AbstractValueAxis3D, StandardCategoryAxis3D

      public abstract class AbstractAxis3D
      extends java.lang.Object
      implements Axis3D, MarkerChangeListener, java.io.Serializable

  A base class that can be used to create an `Axis3D` implementation. This class implements the core axis attributes as well as the change listener mechanism required to enable automatic repainting of charts.
  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
    Modifier and Type | Field and Description
    --- | ---
    `static java.awt.Color` | `DEFAULT_LABEL_COLOR` The default axis label color (in most circumstances this will be overridden by the chart style).
    `static java.awt.Font` | `DEFAULT_LABEL_FONT` The default axis label font (in most circumstances this will be overridden by the chart style).
    `static double` | `DEFAULT_LABEL_OFFSET` The default label offset.
    `static java.awt.Color` | `DEFAULT_LINE_COLOR` The default color for the axis line.
    `static java.awt.Stroke` | `DEFAULT_LINE_STROKE` The default stroke for the axis line.
    `static java.awt.Color` | `DEFAULT_TICK_LABEL_COLOR` The default tick label color (in most circumstances this will be overridden by the chart style).
    `static java.awt.Font` | `DEFAULT_TICK_LABEL_FONT` The default tick label font (in most circumstances this will be overridden by the chart style).

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `AbstractAxis3D(java.lang.String label)` Creates a new label with the specified label.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addChangeListener(Axis3DChangeListener listener)` Registers a listener so that it will receive axis change events.
    `protected abstract java.lang.String` | `axisStr()` Returns a string representing the configured type of the axis ("row", "column", "value", "x", "y" or "z" - other values may be possible in the future).
    `abstract void` | `draw(java.awt.Graphics2D g2, java.awt.geom.Point2D startPt, java.awt.geom.Point2D endPt, java.awt.geom.Point2D opposingPt, java.util.List<TickData> tickData, RenderingInfo info, boolean hinting)` Draws the axis along an arbitrary line (between `startPt` and `endPt`).
    `protected java.awt.Shape` | `drawAxisLabel(java.lang.String label, java.awt.Graphics2D g2, java.awt.geom.Line2D axisLine, java.awt.geom.Point2D opposingPt, double offset, RenderingInfo info, boolean hinting)` Draws the specified text as the axis label and returns a bounding shape (2D) for the text.
    `boolean` | `equals(java.lang.Object obj)` Tests this instance for equality with an arbitrary object.
    `protected void` | `fireChangeEvent(boolean requiresWorldUpdate)` Sends an `Axis3DChangeEvent` to all registered listeners.
    `java.lang.String` | `getLabel()` Returns the axis label - the text that describes what the axis measures.
    `java.awt.Color` | `getLabelColor()` Returns the color used for the label.
    `java.awt.Font` | `getLabelFont()` Returns the font used to display the main axis label.
    `double` | `getLabelOffset()` Returns the offset between the tick labels and the axis label, measured in Java2D units.
    `java.awt.Color` | `getLineColor()` Returns the color used to draw the axis line.
    `java.awt.Stroke` | `getLineStroke()` Returns the stroke used to draw the axis line.
    `java.awt.Color` | `getTickLabelColor()` Returns the foreground color for the tick labels.
    `java.awt.Font` | `getTickLabelFont()` Returns the font used to display the tick labels.
    `boolean` | `getTickLabelsVisible()` Returns the flag that controls whether or not the tick labels are drawn.
    `int` | `hashCode()` Returns a hash code for this instance.
    `boolean` | `isVisible()` Returns the flag that determines whether or not the axis is drawn on the chart.
    `void` | `markerChanged(MarkerChangeEvent event)` Receives notification of a change to a marker managed by this axis - the response is to fire a change event for the axis (to eventually trigger a repaint of the chart).
    `void` | `notifyListeners(Axis3DChangeEvent event)` Notifies all registered listeners that the plot has been modified.
    `abstract void` | `receive(ChartElementVisitor visitor)` Receives a `ChartElementVisitor`.
    `void` | `removeChangeListener(Axis3DChangeListener listener)` Deregisters a listener so that it will no longer receive axis change events.
    `void` | `setLabel(java.lang.String label)` Sets the axis label and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setLabelColor(java.awt.Color color)` Sets the color used to draw the axis label and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setLabelFont(java.awt.Font font)` Sets the font used to display the main axis label and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setLabelOffset(double offset)` Sets the offset between the tick labels and the axis label and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setLineColor(java.awt.Color color)` Sets the color used to draw the axis line and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setLineStroke(java.awt.Stroke stroke)` Sets the stroke used to draw the axis line and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setTickLabelColor(java.awt.Color color)` Sets the foreground color for the tick labels and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setTickLabelFont(java.awt.Font font)` Sets the font used to display tick labels and sends an `Axis3DChangeEvent` to all registered listeners.
    `void` | `setTickLabelsVisible(boolean visible)` Sets the flag that controls whether or not the tick labels are drawn, and sends a change event to all registered listeners.
    `void` | `setVisible(boolean visible)` Sets the flag that determines whether or not the axis is drawn on the chart and sends an `Axis3DChangeEvent` to all registered listeners.

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

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

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

      `getRange, isInverted, setInverted, setRange, setRange, translateToWorld`

- - ### Field Detail

    - #### DEFAULT_LABEL_FONT

          public static final java.awt.Font DEFAULT_LABEL_FONT

      The default axis label font (in most circumstances this will be overridden by the chart style).
      Since:
        1.2

    - #### DEFAULT_LABEL_COLOR

          public static final java.awt.Color DEFAULT_LABEL_COLOR

      The default axis label color (in most circumstances this will be overridden by the chart style).
      Since:
        1.2

    - #### DEFAULT_LABEL_OFFSET

          public static final double DEFAULT_LABEL_OFFSET

      The default label offset.
      Since:
        1.2
      See Also:
        Constant Field Values

    - #### DEFAULT_TICK_LABEL_FONT

          public static final java.awt.Font DEFAULT_TICK_LABEL_FONT

      The default tick label font (in most circumstances this will be overridden by the chart style).
      Since:
        1.2

    - #### DEFAULT_TICK_LABEL_COLOR

          public static final java.awt.Color DEFAULT_TICK_LABEL_COLOR

      The default tick label color (in most circumstances this will be overridden by the chart style).
      Since:
        1.2

    - #### DEFAULT_LINE_STROKE

          public static final java.awt.Stroke DEFAULT_LINE_STROKE

      The default stroke for the axis line.
      Since:
        1.2

    - #### DEFAULT_LINE_COLOR

          public static final java.awt.Color DEFAULT_LINE_COLOR

      The default color for the axis line.
      Since:
        1.2

  - ### Constructor Detail

    - #### AbstractAxis3D

          public AbstractAxis3D(java.lang.String label)

      Creates a new label with the specified label. If the supplied label is `null`, the axis will be shown without a label.
      Parameters:
        `label` - the axis label (`null` permitted).

  - ### Method Detail

    - #### isVisible

          public boolean isVisible()

      Returns the flag that determines whether or not the axis is drawn on the chart.
      Specified by:
        `isVisible` in interface `Axis3D`
      Returns:
        A boolean.
      See Also:
        `setVisible(boolean)`

    - #### setVisible

          public void setVisible(boolean visible)

      Sets the flag that determines whether or not the axis is drawn on the chart and sends an `Axis3DChangeEvent` to all registered listeners.
      Specified by:
        `setVisible` in interface `Axis3D`
      Parameters:
        `visible` - the flag.
      See Also:
        `isVisible()`

    - #### getLabel

          public java.lang.String getLabel()

      Returns the axis label - the text that describes what the axis measures. The description should usually specify the units. When this attribute is `null`, the axis is drawn without a label.
      Returns:
        The axis label (possibly `null`).

    - #### setLabel

          public void setLabel(java.lang.String label)

      Sets the axis label and sends an `Axis3DChangeEvent` to all registered listeners. If the supplied label is `null`, the axis will be drawn without a label.
      Parameters:
        `label` - the label (`null` permitted).

    - #### getLabelFont

          public java.awt.Font getLabelFont()

      Returns the font used to display the main axis label. The default value is `Font("SansSerif", Font.BOLD, 12)`.
      Specified by:
        `getLabelFont` in interface `Axis3D`
      Returns:
        The font used to display the axis label (never `null`).

    - #### setLabelFont

          public void setLabelFont(java.awt.Font font)

      Sets the font used to display the main axis label and sends an `Axis3DChangeEvent` to all registered listeners.
      Specified by:
        `setLabelFont` in interface `Axis3D`
      Parameters:
        `font` - the new font (`null` not permitted).

    - #### getLabelColor

          public java.awt.Color getLabelColor()

      Returns the color used for the label. The default value is `Color.BLACK`.
      Specified by:
        `getLabelColor` in interface `Axis3D`
      Returns:
        The label paint (never `null`).

    - #### setLabelColor

          public void setLabelColor(java.awt.Color color)

      Sets the color used to draw the axis label and sends an `Axis3DChangeEvent` to all registered listeners.
      Specified by:
        `setLabelColor` in interface `Axis3D`
      Parameters:
        `color` - the color (`null` not permitted).

    - #### getLabelOffset

          public double getLabelOffset()

      Returns the offset between the tick labels and the axis label, measured in Java2D units. The default value is `DEFAULT_LABEL_OFFSET`.
      Returns:
        The offset.
      Since:
        1.2

    - #### setLabelOffset

          public void setLabelOffset(double offset)

      Sets the offset between the tick labels and the axis label and sends an `Axis3DChangeEvent` to all registered listeners.
      Parameters:
        `offset` - the offset.
      Since:
        1.2

    - #### getLineStroke

          public java.awt.Stroke getLineStroke()

      Returns the stroke used to draw the axis line. The default value is `DEFAULT_LINE_STROKE`.
      Returns:
        The stroke used to draw the axis line (never `null`).

    - #### setLineStroke

          public void setLineStroke(java.awt.Stroke stroke)

      Sets the stroke used to draw the axis line and sends an `Axis3DChangeEvent` to all registered listeners.
      Parameters:
        `stroke` - the new stroke (`null` not permitted).

    - #### getLineColor

          public java.awt.Color getLineColor()

      Returns the color used to draw the axis line. The default value is `DEFAULT_LINE_COLOR`.
      Returns:
        The color used to draw the axis line (never `null`).

    - #### setLineColor

          public void setLineColor(java.awt.Color color)

      Sets the color used to draw the axis line and sends an `Axis3DChangeEvent` to all registered listeners.
      Parameters:
        `color` - the new color (`null` not permitted).

    - #### getTickLabelsVisible

          public boolean getTickLabelsVisible()

      Returns the flag that controls whether or not the tick labels are drawn. The default value is `true`.
      Returns:
        A boolean.

    - #### setTickLabelsVisible

          public void setTickLabelsVisible(boolean visible)

      Sets the flag that controls whether or not the tick labels are drawn, and sends a change event to all registered listeners. You should think carefully before setting this flag to `false`, because if the tick labels are not shown it will be hard for the reader to understand the resulting chart.
      Parameters:
        `visible` - visible?

    - #### getTickLabelFont

          public java.awt.Font getTickLabelFont()

      Returns the font used to display the tick labels. The default value is `DEFAULT_TICK_LABEL_FONT`.
      Specified by:
        `getTickLabelFont` in interface `Axis3D`
      Returns:
        The font (never `null`).

    - #### setTickLabelFont

          public void setTickLabelFont(java.awt.Font font)

      Sets the font used to display tick labels and sends an `Axis3DChangeEvent` to all registered listeners.
      Specified by:
        `setTickLabelFont` in interface `Axis3D`
      Parameters:
        `font` - the font (`null` not permitted).

    - #### getTickLabelColor

          public java.awt.Color getTickLabelColor()

      Returns the foreground color for the tick labels. The default value is `DEFAULT_LABEL_COLOR`.
      Specified by:
        `getTickLabelColor` in interface `Axis3D`
      Returns:
        The foreground color (never `null`).

    - #### setTickLabelColor

          public void setTickLabelColor(java.awt.Color color)

      Sets the foreground color for the tick labels and sends an `Axis3DChangeEvent` to all registered listeners.
      Specified by:
        `setTickLabelColor` in interface `Axis3D`
      Parameters:
        `color` - the color (`null` not permitted).

    - #### receive

          public abstract void receive(ChartElementVisitor visitor)

      Receives a `ChartElementVisitor`. This method is part of a general mechanism for traversing the chart structure and performing operations on each element in the chart. You will not normally call this method directly.
      Specified by:
        `receive` in interface `ChartElement`
      Parameters:
        `visitor` - the visitor (`null` not permitted).
      Since:
        1.2

    - #### drawAxisLabel

          protected java.awt.Shape drawAxisLabel(java.lang.String label,
                                                 java.awt.Graphics2D g2,
                                                 java.awt.geom.Line2D axisLine,
                                                 java.awt.geom.Point2D opposingPt,
                                                 double offset,
                                                 RenderingInfo info,
                                                 boolean hinting)

      Draws the specified text as the axis label and returns a bounding shape (2D) for the text.
      Parameters:
        `label` - the label (`null` not permitted).
        `g2` - the graphics target (`null` not permitted).
        `axisLine` - the axis line (`null` not permitted).
        `opposingPt` - an opposing point (`null` not permitted).
        `offset` - the offset.
        `info` - collects rendering info (`null` permitted).
        `hinting` - perform element hinting?
      Returns:
        A bounding shape.

    - #### axisStr

          protected abstract java.lang.String axisStr()

      Returns a string representing the configured type of the axis ("row", "column", "value", "x", "y" or "z" - other values may be possible in the future). A row axis on a `CategoryPlot3D` is in the position of a z-axis (depth), a column axis is in the position of an x-axis (width), a value axis is in the position of a y-axis (height).
      Returns:
        A string (never `null`).
      Since:
        1.3

    - #### draw

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

      Draws the axis along an arbitrary line (between `startPt` and `endPt`). The opposing point is used as a reference point to know on which side of the axis to draw the labels.
      Specified by:
        `draw` in interface `Axis3D`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `startPt` - the starting point (`null` not permitted).
        `endPt` - the end point (`null` not permitted)
        `opposingPt` - an opposing point (`null` not permitted).
        `tickData` - info about the ticks to draw (`null` not permitted).
        `info` - an object to be populated with rendering info (`null` permitted).
        `hinting` - a flag that controls whether or not element hinting should be performed.

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this instance for equality with an arbitrary object.
      Overrides:
        `equals` in class `java.lang.Object`
      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 `java.lang.Object`
      Returns:
        A hash code.

    - #### addChangeListener

          public void addChangeListener(Axis3DChangeListener listener)

      Registers a listener so that it will receive axis change events.
      Specified by:
        `addChangeListener` in interface `Axis3D`
      Parameters:
        `listener` - the listener (`null` not permitted).

    - #### removeChangeListener

          public void removeChangeListener(Axis3DChangeListener listener)

      Deregisters a listener so that it will no longer receive axis change events.
      Specified by:
        `removeChangeListener` in interface `Axis3D`
      Parameters:
        `listener` - the listener (`null` not permitted).

    - #### notifyListeners

          public void notifyListeners(Axis3DChangeEvent event)

      Notifies all registered listeners that the plot has been modified.
      Parameters:
        `event` - information about the change event.

    - #### fireChangeEvent

          protected void fireChangeEvent(boolean requiresWorldUpdate)

      Sends an `Axis3DChangeEvent` to all registered listeners.
      Parameters:
        `requiresWorldUpdate` - a flag indicating whether or not this change requires the 3D world to be updated.

    - #### markerChanged

          public void markerChanged(MarkerChangeEvent event)

      Receives notification of a change to a marker managed by this axis - the response is to fire a change event for the axis (to eventually trigger a repaint of the chart). Marker changes don't require the world model to be updated.
      Specified by:
        `markerChanged` in interface `MarkerChangeListener`
      Parameters:
        `event` - the event.
      Since:
        1.2