Module org.jfree.chart3d
Package org.jfree.chart3d.marker

# Class CategoryMarker

java.lang.Object
org.jfree.chart3d.marker.AbstractMarker
org.jfree.chart3d.marker.CategoryMarker

All Implemented Interfaces:
  `Serializable`, `ChartElement`, `Marker`

public class CategoryMarker extends AbstractMarker implements 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 org.jfree.chart3d.marker.Marker

`DEFAULT_FILL_COLOR, DEFAULT_LABEL_COLOR, DEFAULT_LINE_COLOR, DEFAULT_LINE_STROKE, DEFAULT_MARKER_FONT`

## Constructor Summary

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

## Method Summary

Modifier and Type
Method
Description
`void`
`draw(Graphics2D g2, MarkerData markerData, boolean reverse)`
Handles drawing of the marker.
`boolean`
`equals(Object obj)`
`Comparable<?>`
`getCategory()`
Returns the category.
`Color`
`getFillColor()`
Returns the color used to fill the marker band.
`Font`
`getFont()`
Returns the font for the label.
`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.
`Color`
`getLabelColor()`
Returns the label color.
`Color`
`getLineColor()`
Returns the line color for the marker.
`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(Comparable<?> category)`
Sets the category for the marker and sends a change event to all registered listeners.
`void`
`setFillColor(Color color)`
Sets the color used to fill the marker band and sends a change event to all registered listeners.
`void`
`setFont(Font font)`
Sets the font for the marker label and sends a change event to all registered listeners.
`void`
`setLabel(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(Color color)`
Sets the label color and sends a change event to all registered listeners.
`void`
`setLineColor(Color color)`
Sets the line color for the marker and sends a change event to all registered listeners.
`void`
`setLineStroke(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 org.jfree.chart3d.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 Details

### CategoryMarker

public CategoryMarker(Comparable<?> category)
Creates a marker for the specified category.

Parameters:
  `category` - the category key (`null` not permitted).

## Method Details

### getCategory

public Comparable<?> getCategory()
Returns the category.

Returns:
  The category (never `null`).

### setCategory

public void setCategory(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 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(String label)
Sets the label and sends a change event to all registered listeners.

Parameters:
  `label` - the label (`null` permitted).

### getFont

public 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(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 Color getLabelColor()
Returns the label color. The default value is `Marker.DEFAULT_LABEL_COLOR`.

Returns:
  The label color (never `null`).

### setLabelColor

public void setLabelColor(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 Color getLineColor()
Returns the line color for the marker.

Returns:
  The line color (never `null`).

### setLineColor

public void setLineColor(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 Stroke getLineStroke()
Returns the line stroke. The default value is `Marker.DEFAULT_LINE_STROKE`.

Returns:
  The line stroke (never `null`).

### setLineStroke

public void setLineStroke(Stroke stroke)
Sets the line stroke and sends a change event to all registered listeners.

Parameters:
  `stroke` - the stroke (`null` not permitted).

### getFillColor

public Color getFillColor()
Returns the color used to fill the marker band.

Returns:
  The color (never `null`).

### setFillColor

public void setFillColor(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(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 `Object`

### equals

public boolean equals(Object obj)

Overrides:
  `equals` in class `Object`