com.orsoncharts.renderer.category

## Class StandardCategoryColorSource

- java.lang.Object
- - com.orsoncharts.renderer.category.StandardCategoryColorSource

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

      public class StandardCategoryColorSource
      extends java.lang.Object
      implements CategoryColorSource, java.io.Serializable

  A standard implementation of the `CategoryColorSource` interface.
  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
    `StandardCategoryColorSource()` Creates a new instance with default colors.
    `StandardCategoryColorSource(java.awt.Color... colors)` Creates a new instance with the supplied sequence of colors.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)` Tests this color source for equality with an arbitrary object.
    `java.awt.Color` | `getColor(int series, int row, int column)` Returns the color to use for the specified item.
    `java.awt.Color` | `getLegendColor(int series)` Returns the color to use in the legend for the specified series.
    `int` | `hashCode()`
    `void` | `style(java.awt.Color... colors)` Restyles the source using the specified colors.

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

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

- - ### Constructor Detail

    - #### StandardCategoryColorSource

          public StandardCategoryColorSource()

      Creates a new instance with default colors.

    - #### StandardCategoryColorSource

          public StandardCategoryColorSource(java.awt.Color... colors)

      Creates a new instance with the supplied sequence of colors. The supplied array must have at least one entry, and all entries must be non-`null`.
      Parameters:
        `colors` - the colors (`null` not permitted).

  - ### Method Detail

    - #### getColor

          public java.awt.Color getColor(int series,
                                         int row,
                                         int column)

      Returns the color to use for the specified item.
      Specified by:
        `getColor` in interface `CategoryColorSource`
      Parameters:
        `series` - the series index.
        `row` - the row index.
        `column` - the column index.
      Returns:
        The color (never `null`).

    - #### getLegendColor

          public java.awt.Color getLegendColor(int series)

      Returns the color to use in the legend for the specified series.
      Specified by:
        `getLegendColor` in interface `CategoryColorSource`
      Parameters:
        `series` - the series index.
      Returns:
        The color (never `null`).

    - #### style

          public void style(java.awt.Color... colors)

      Restyles the source using the specified colors. Refer to the implementing class to confirm the precise behaviour (typically all existing color settings are cleared and the specified colors are installed as the new defaults).
      Specified by:
        `style` in interface `CategoryColorSource`
      Parameters:
        `colors` - the colors.
      Since:
        1.2

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this color source for equality with an arbitrary object.
      Overrides:
        `equals` in class `java.lang.Object`
      Parameters:
        `obj` - the object (`null` permitted).
      Returns:
        A boolean.

    - #### hashCode

          public int hashCode()

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