com.orsoncharts.marker

## Class CategoryMarker

- java.lang.Object
- - com.orsoncharts.marker.AbstractMarker
  - - com.orsoncharts.marker.CategoryMarker

- All Implemented Interfaces:
    ChartElement, Marker, java.io.Serializable

      public class CategoryMarker
      extends AbstractMarker
      implements java.io.Serializable

  A marker for a category on a `CategoryAxis3D`. This marker could be used to highlight one selected category.
  For an example, please refer to the demo `CategoryMarkerDemo1.java`.
  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.
  Since:
    1.2
  See Also:
    Serialized Form

- - ### Field Summary

    - ### Fields inherited from interface com.orsoncharts.marker.Marker

      `DEFAULT_FILL_COLOR, DEFAULT_LABEL_COLOR, DEFAULT_LINE_COLOR, DEFAULT_LINE_STROKE, DEFAULT_MARKER_FONT`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `CategoryMarker(java.lang.Comparable<?> category)` Creates a marker for the specified category.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `draw(java.awt.Graphics2D g2, MarkerData markerData, boolean reverse)` Handles drawing of the marker.
    `boolean` | `equals(java.lang.Object obj)`
    `java.lang.Comparable<?>` | `getCategory()` Returns the category.
    `java.awt.Color` | `getFillColor()` Returns the color used to fill the marker band.
    `java.awt.Font` | `getFont()` Returns the font for the label.
    `java.lang.String` | `getLabel()` Returns the label for the marker (if this is `null` then no label is displayed).
    `Anchor2D` | `getLabelAnchor()` Returns the anchor for the label.
    `java.awt.Color` | `getLabelColor()` Returns the label color.
    `java.awt.Color` | `getLineColor()` Returns the line color for the marker.
    `java.awt.Stroke` | `getLineStroke()` Returns the line stroke.
    `CategoryMarkerType` | `getType()` Returns the marker type which determines whether the marker is drawn as a band (the default) or a line.
    `int` | `hashCode()`
    `void` | `setCategory(java.lang.Comparable<?> category)` Sets the category for the marker and sends a change event to all registered listeners.
    `void` | `setFillColor(java.awt.Color color)` Sets the color used to fill the marker band and sends a change event to all registered listeners.
    `void` | `setFont(java.awt.Font font)` Sets the font for the marker label and sends a change event to all registered listeners.
    `void` | `setLabel(java.lang.String label)` Sets the label and sends a change event to all registered listeners.
    `void` | `setLabelAnchor(Anchor2D anchor)` Sets the anchor for the label and sends a change event to all registered listeners.
    `void` | `setLabelColor(java.awt.Color color)` Sets the label color and sends a change event to all registered listeners.
    `void` | `setLineColor(java.awt.Color color)` Sets the line color for the marker and sends a change event to all registered listeners.
    `void` | `setLineStroke(java.awt.Stroke stroke)` Sets the line stroke and sends a change event to all registered listeners.
    `void` | `setType(CategoryMarkerType type)` Sets the marker type and sends a change event to all registered listeners.

    - ### Methods inherited from class com.orsoncharts.marker.AbstractMarker

      `addChangeListener, deriveTextAnchor, deriveTextAnchorForLine, drawMarkerLabel, drawMarkerLabel, fireChangeEvent, receive, removeChangeListener`

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

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

- - ### Constructor Detail

    - #### CategoryMarker

          public CategoryMarker(java.lang.Comparable<?> category)

      Creates a marker for the specified category.
      Parameters:
        `category` - the category key (`null` not permitted).

  - ### Method Detail

    - #### getCategory

          public java.lang.Comparable<?> getCategory()

      Returns the category.
      Returns:
        The category (never `null`).

    - #### setCategory

          public void setCategory(java.lang.Comparable<?> category)

      Sets the category for the marker and sends a change event to all registered listeners.
      Parameters:
        `category` - the new category (`null` not permitted).

    - #### getType

          public CategoryMarkerType getType()

      Returns the marker type which determines whether the marker is drawn as a band (the default) or a line.
      Returns:
        The type (never `null`).

    - #### setType

          public void setType(CategoryMarkerType type)

      Sets the marker type and sends a change event to all registered listeners.
      Parameters:
        `type` - the type (`null` not permitted).

    - #### getLabel

          public java.lang.String getLabel()

      Returns the label for the marker (if this is `null` then no label is displayed).
      Returns:
        The label (possibly `null`).

    - #### setLabel

          public void setLabel(java.lang.String label)

      Sets the label and sends a change event to all registered listeners.
      Parameters:
        `label` - the label (`null` permitted).

    - #### getFont

          public java.awt.Font getFont()

      Returns the font for the label. The default value is `Marker.DEFAULT_MARKER_FONT`.
      Returns:
        The font (never `null`).

    - #### setFont

          public void setFont(java.awt.Font font)

      Sets the font for the marker label and sends a change event to all registered listeners.
      Parameters:
        `font` - the font (`null` not permitted).

    - #### getLabelColor

          public java.awt.Color getLabelColor()

      Returns the label color. The default value is `Marker.DEFAULT_LABEL_COLOR`.
      Returns:
        The label color (never `null`).

    - #### setLabelColor

          public void setLabelColor(java.awt.Color color)

      Sets the label color and sends a change event to all registered listeners.
      Parameters:
        `color` - the color (`null` not permitted).

    - #### getLabelAnchor

          public Anchor2D getLabelAnchor()

      Returns the anchor for the label. The default value is `Anchor2D.CENTER`.
      Returns:
        The anchor for the label.

    - #### setLabelAnchor

          public void setLabelAnchor(Anchor2D anchor)

      Sets the anchor for the label and sends a change event to all registered listeners.
      Parameters:
        `anchor` - the anchor (`null` not permitted).

    - #### getLineColor

          public java.awt.Color getLineColor()

      Returns the line color for the marker.
      Returns:
        The line color (never `null`).

    - #### setLineColor

          public void setLineColor(java.awt.Color color)

      Sets the line color for the marker and sends a change event to all registered listeners.
      Parameters:
        `color` - the color (`null` not permitted).

    - #### getLineStroke

          public java.awt.Stroke getLineStroke()

      Returns the line stroke. The default value is `Marker.DEFAULT_LINE_STROKE`.
      Returns:
        The line stroke (never `null`).

    - #### setLineStroke

          public void setLineStroke(java.awt.Stroke stroke)

      Sets the line stroke and sends a change event to all registered listeners.
      Parameters:
        `stroke` - the stroke (`null` not permitted).

    - #### getFillColor

          public java.awt.Color getFillColor()

      Returns the color used to fill the marker band.
      Returns:
        The color (never `null`).

    - #### setFillColor

          public void setFillColor(java.awt.Color color)

      Sets the color used to fill the marker band and sends a change event to all registered listeners.
      Parameters:
        `color` - the color (`null` not permitted).

    - #### draw

          public void draw(java.awt.Graphics2D g2,
                           MarkerData markerData,
                           boolean reverse)

      Handles drawing of the marker. This method is called by the library, you won't normally call it directly.
      Specified by:
        `draw` in interface `Marker`
      Parameters:
        `g2` - the graphics device (`null` not permitted).
        `markerData` - the marker data (`null` not permitted).
        `reverse` - a flag to indicate reverse orientation.

    - #### hashCode

          public int hashCode()

      Overrides:
        `hashCode` in class `java.lang.Object`

    - #### equals

          public boolean equals(java.lang.Object obj)

      Overrides:
        `equals` in class `java.lang.Object`