com.orsoncharts.axis

## Class NumberTickSelector

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

- All Implemented Interfaces:
    TickSelector, java.io.Serializable

      public class NumberTickSelector
      extends java.lang.Object
      implements TickSelector, java.io.Serializable

  A `TickSelector` implementation that selects tick units in multiples of 1, 2 and 5.
  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 Summary

    Constructors
    Constructor and Description
    `NumberTickSelector()` Creates a new instance.
    `NumberTickSelector(boolean percentage)` Creates a new instance, with the option to display the tick values as percentages.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)` Tests this instance for equality with an arbitrary object.
    `java.text.Format` | `getCurrentTickLabelFormat()` Returns the tick formatter associated with the tick size that the cursor is currently referencing.
    `double` | `getCurrentTickSize()` Returns the tick size that the cursor is currently referencing.
    `boolean` | `next()` Move the cursor to the next (larger) tick size, if there is one.
    `boolean` | `previous()` Move the cursor to the previous (smaller) tick size, if there is one.
    `double` | `select(double reference)` Selects and returns a standard tick size that is greater than or equal to the specified reference value and, ideally, as close to it as possible (to minimise the number of iterations used by axes to determine the tick size to use).

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

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

- - ### Constructor Detail

    - #### NumberTickSelector

          public NumberTickSelector()

      Creates a new instance.

    - #### NumberTickSelector

          public NumberTickSelector(boolean percentage)

      Creates a new instance, with the option to display the tick values as percentages. The axis follows the normal convention that values in the range 0.0 to 1.0 a represented as 0% to 100%.
      Parameters:
        `percentage` - format the tick values as percentages.

  - ### Method Detail

    - #### select

          public double select(double reference)

      Selects and returns a standard tick size that is greater than or equal to the specified reference value and, ideally, as close to it as possible (to minimise the number of iterations used by axes to determine the tick size to use). After a call to this method, the `getCurrentTickSize()` method should return the selected tick size (there is a "pointer" to this tick size), the `next()` method should move the pointer to the next (larger) standard tick size, and the `previous()` method should move the pointer to the previous (smaller) standard tick size.
      Specified by:
        `select` in interface `TickSelector`
      Parameters:
        `reference` - the reference value (must be positive and finite).
      Returns:
        The selected tick size.

    - #### next

          public boolean next()

      Move the cursor to the next (larger) tick size, if there is one. Returns `true` in the case that the cursor is moved, and `false` where there are a finite number of tick sizes and the current tick size is the largest available.
      Specified by:
        `next` in interface `TickSelector`
      Returns:
        A boolean.

    - #### previous

          public boolean previous()

      Move the cursor to the previous (smaller) tick size, if there is one. Returns `true` in the case that the cursor is moved, and `false` where there are a finite number of tick sizes and the current tick size is the smallest available.
      Specified by:
        `previous` in interface `TickSelector`
      Returns:
        A boolean.

    - #### getCurrentTickSize

          public double getCurrentTickSize()

      Description copied from interface: `TickSelector`
      Returns the tick size that the cursor is currently referencing.
      Specified by:
        `getCurrentTickSize` in interface `TickSelector`
      Returns:
        The tick size.

    - #### getCurrentTickLabelFormat

          public java.text.Format getCurrentTickLabelFormat()

      Description copied from interface: `TickSelector`
      Returns the tick formatter associated with the tick size that the cursor is currently referencing.
      Specified by:
        `getCurrentTickLabelFormat` in interface `TickSelector`
      Returns:
        The formatter.

    - #### 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 (`null` permitted).
      Returns:
        A boolean.