com.orsoncharts.marker

## Class RangeMarker

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

- All Implemented Interfaces:
    ChartElement, Marker, MarkerChangeListener, ValueMarker, java.io.Serializable, java.util.EventListener

      public class RangeMarker
      extends AbstractMarker
      implements ValueMarker, MarkerChangeListener, java.io.Serializable

  A marker that marks a range of values on an axis.
  For an example, please refer to the demo `RangeMarkerDemo1.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
    `RangeMarker(double lowerBound, double upperBound)` Creates a new range marker for the given bounds.
    `RangeMarker(double lowerBound, double upperBound, java.lang.String label)` Creates a new range marker for the given bounds.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `draw(java.awt.Graphics2D g2, MarkerData markerData, boolean reverse)` Draws the marker based on the `markerData` which has been passed to the 3D engine to generate the required 2D projection points.
    `boolean` | `equals(java.lang.Object obj)` Tests this marker for equality with an arbitrary object.
    `NumberMarker` | `getEnd()` Returns the ending point for the range marker.
    `java.awt.Color` | `getFillColor()` Returns the color used to fill the band representing the range for the marker.
    `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.
    `Range` | `getRange()` Returns the range of values for the marker.
    `NumberMarker` | `getStart()` Returns the starting point for the range marker.
    `int` | `hashCode()`
    `void` | `markerChanged(MarkerChangeEvent event)` Receives notification of a change to the start or end marker for the range.
    `void` | `setFillColor(java.awt.Color color)` Sets the color used to fill the band representing the range for the marker 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.

    - ### 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`

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

      `addChangeListener, removeChangeListener`

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

      `receive`

- - ### Constructor Detail

    - #### RangeMarker

          public RangeMarker(double lowerBound,
                             double upperBound)

      Creates a new range marker for the given bounds.
      Parameters:
        `lowerBound` - the lower bound.
        `upperBound` - the upper bound.

    - #### RangeMarker

          public RangeMarker(double lowerBound,
                             double upperBound,
                             java.lang.String label)

      Creates a new range marker for the given bounds.
      Parameters:
        `lowerBound` - the lower bound.
        `upperBound` - the upper bound.
        `label` - the label (`null` permitted).

  - ### Method Detail

    - #### getStart

          public NumberMarker getStart()

      Returns the starting point for the range marker.
      Returns:
        The starting point.

    - #### getEnd

          public NumberMarker getEnd()

      Returns the ending point for the range marker.
      Returns:
        The ending point.

    - #### getRange

          public Range getRange()

      Returns the range of values for the marker.
      Specified by:
        `getRange` in interface `ValueMarker`
      Returns:
        The range of values for the marker.

    - #### 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. If the label is set to `null` then no label is displayed for the marker.
      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).

    - #### getFillColor

          public java.awt.Color getFillColor()

      Returns the color used to fill the band representing the range for the marker. The default value is `Marker.DEFAULT_FILL_COLOR`.
      Returns:
        The fill color (never `null`).

    - #### setFillColor

          public void setFillColor(java.awt.Color color)

      Sets the color used to fill the band representing the range for the marker 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)

      Description copied from interface: `Marker`
      Draws the marker based on the `markerData` which has been passed to the 3D engine to generate the required 2D projection points.
      Specified by:
        `draw` in interface `Marker`
      Parameters:
        `g2` - the graphics target (`null` not permitted).
        `markerData` - transient data for the marker (`null` not permitted).
        `reverse` - a flag to indicate reverse orientation.

    - #### markerChanged

          public void markerChanged(MarkerChangeEvent event)

      Receives notification of a change to the start or end marker for the range.
      Specified by:
        `markerChanged` in interface `MarkerChangeListener`
      Parameters:
        `event` - the event (`null` not permitted).

    - #### hashCode

          public int hashCode()

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

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this marker 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.