com.orsoncharts.label

## Class StandardCategoryItemLabelGenerator

- java.lang.Object
- - com.orsoncharts.label.StandardCategoryItemLabelGenerator

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

      public class StandardCategoryItemLabelGenerator
      extends java.lang.Object
      implements CategoryItemLabelGenerator, java.io.Serializable

  A default implementation of the `CategoryItemLabelGenerator` interface. The implementation uses a `Formatter` instance to generate the labels. Four values are passed to the formatter: (1) the key for the series, (2) the row key, (3) the column key and (4) the data value.
  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.3
  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static java.lang.String` | `DEFAULT_TEMPLATE` The default template string (used in the default constructor, it is equivalent to `SERIES_AND_COLUMN_KEYS_AND_VALUE_TEMPLATE`).
    `static java.lang.String` | `KEYS_AND_VALUE_TEMPLATE` A template string that will show the series, row and column keys plus the data value.
    `static java.lang.String` | `SERIES_AND_COLUMN_KEYS_AND_VALUE_TEMPLATE` A template that shows the series key, column key and value (the row key is omitted because it is often the same as the series key).
    `static java.lang.String` | `VALUE_TEMPLATE` A template string that will show just the value (to 2 decimal places).

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `StandardCategoryItemLabelGenerator()` The default constructor.
    `StandardCategoryItemLabelGenerator(java.lang.String template)` Creates a new instance with the specified template string (which will be passed to a `java.util.Formatter` instance when generating labels).

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `equals(java.lang.Object obj)` Tests this label generator for equality with an arbitrary object.
    `java.lang.String` | `generateItemLabel(CategoryDataset3D dataset, java.lang.Comparable<?> seriesKey, java.lang.Comparable<?> rowKey, java.lang.Comparable<?> columnKey)` Generates the item label for one data item in a category chart.
    `KeyedValues3DItemSelection` | `getItemSelection()` Returns the item selection.
    `int` | `hashCode()`
    `void` | `setItemSelection(StandardKeyedValues3DItemSelection selection)` Sets the item selection (labels will be created by this generator only for data items that are contained in the collection).

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

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

- - ### Field Detail

    - #### VALUE_TEMPLATE

          public static final java.lang.String VALUE_TEMPLATE

      A template string that will show just the value (to 2 decimal places).
      Since:
        1.3
      See Also:
        Constant Field Values

    - #### KEYS_AND_VALUE_TEMPLATE

          public static final java.lang.String KEYS_AND_VALUE_TEMPLATE

      A template string that will show the series, row and column keys plus the data value.
      Since:
        1.3
      See Also:
        Constant Field Values

    - #### SERIES_AND_COLUMN_KEYS_AND_VALUE_TEMPLATE

          public static final java.lang.String SERIES_AND_COLUMN_KEYS_AND_VALUE_TEMPLATE

      A template that shows the series key, column key and value (the row key is omitted because it is often the same as the series key).
      Since:
        1.3
      See Also:
        Constant Field Values

    - #### DEFAULT_TEMPLATE

          public static final java.lang.String DEFAULT_TEMPLATE

      The default template string (used in the default constructor, it is equivalent to `SERIES_AND_COLUMN_KEYS_AND_VALUE_TEMPLATE`).
      Since:
        1.3
      See Also:
        Constant Field Values

  - ### Constructor Detail

    - #### StandardCategoryItemLabelGenerator

          public StandardCategoryItemLabelGenerator()

      The default constructor.

    - #### StandardCategoryItemLabelGenerator

          public StandardCategoryItemLabelGenerator(java.lang.String template)

      Creates a new instance with the specified template string (which will be passed to a `java.util.Formatter` instance when generating labels). See the class description for an explanation of the values that are available for use in the template string.
      Parameters:
        `template` - the template (`null` not permitted).

  - ### Method Detail

    - #### getItemSelection

          public KeyedValues3DItemSelection getItemSelection()

      Returns the item selection. The default value is `null`.
      Returns:
        The item selection.
      Since:
        1.3

    - #### setItemSelection

          public void setItemSelection(StandardKeyedValues3DItemSelection selection)

      Sets the item selection (labels will be created by this generator only for data items that are contained in the collection). If you set the selection to `null` then the generator will create labels for all data items.
      Parameters:
        `selection` - the selection (`null` permitted).

    - #### generateItemLabel

          public java.lang.String generateItemLabel(CategoryDataset3D dataset,
                                                    java.lang.Comparable<?> seriesKey,
                                                    java.lang.Comparable<?> rowKey,
                                                    java.lang.Comparable<?> columnKey)

      Generates the item label for one data item in a category chart.
      Specified by:
        `generateItemLabel` in interface `CategoryItemLabelGenerator`
      Parameters:
        `dataset` - the dataset (`null` not permitted).
        `seriesKey` - the series key (`null` not permitted).
        `rowKey` - the row key (`null` not permitted).
        `columnKey` - the column key (`null` not permitted).
      Returns:
        The label (never `null` for this implementation).

    - #### equals

          public boolean equals(java.lang.Object obj)

      Tests this label generator 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`