Module org.jfree.chart3d
Package org.jfree.chart3d.label

# Class StandardPieLabelGenerator

java.lang.Object
org.jfree.chart3d.label.StandardPieLabelGenerator

All Implemented Interfaces:
  `Serializable`, `PieLabelGenerator`

public class StandardPieLabelGenerator extends Object implements PieLabelGenerator, Serializable
A default implementation of the `PieLabelGenerator` interface. The implementation uses a `Formatter` instance to generate the labels. Three values are passed to the formatter: (1) the key for the current pie section, (2) the data value for the section (as a `Double`, possibly `null`) and (3) the calculated percentage value (as a `Double`, `Double.NaN` if the value is `null`).
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
Modifier and Type
Field
Description
`static final String`
`DEFAULT_TEMPLATE`
The default template string (used in the default constructor, it is equivalent to `PERCENT_TEMPLATE`).
`static final String`
`KEY_ONLY_TEMPLATE`
A template string that will show the section key only.
`static final String`
`PERCENT_TEMPLATE`
A template string that will show the section key followed by the percentage in brackets (with zero decimal places).
`static final String`
`PERCENT_TEMPLATE_2DP`
A template string that will show the section key followed by the percentage in brackets (with two decimal places precision).
`static final String`
`VALUE_TEMPLATE`
A template string that will show the section key followed by the value in brackets (with zero decimal places precision).
`static final String`
`VALUE_TEMPLATE_2DP`
A template string that will show the section key followed by the value in brackets (with two decimal places precision).

## Constructor Summary

Constructors
Constructor
Description
`StandardPieLabelGenerator()`
The default constructor, uses `DEFAULT_TEMPLATE` for the template string.
`StandardPieLabelGenerator(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

Modifier and Type
Method
Description
`boolean`
`equals(Object obj)`
Tests this label generator for equality with an arbitrary object.
`String`
`generateLabel(PieDataset3D dataset, Comparable<?> key)`
Generates the label for one section in a pie chart.
`int`
`hashCode()`

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

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

## Field Details

### KEY_ONLY_TEMPLATE

public static final String KEY_ONLY_TEMPLATE
A template string that will show the section key only.

Since:
  1.2
See Also:
  - Constant Field Values

### PERCENT_TEMPLATE

public static final String PERCENT_TEMPLATE
A template string that will show the section key followed by the percentage in brackets (with zero decimal places).

Since:
  1.2
See Also:
  - Constant Field Values

### PERCENT_TEMPLATE_2DP

public static final String PERCENT_TEMPLATE_2DP
A template string that will show the section key followed by the percentage in brackets (with two decimal places precision).

Since:
  1.2
See Also:
  - Constant Field Values

### VALUE_TEMPLATE

public static final String VALUE_TEMPLATE
A template string that will show the section key followed by the value in brackets (with zero decimal places precision).

Since:
  1.2
See Also:
  - Constant Field Values

### VALUE_TEMPLATE_2DP

public static final String VALUE_TEMPLATE_2DP
A template string that will show the section key followed by the value in brackets (with two decimal places precision).

Since:
  1.2
See Also:
  - Constant Field Values

### DEFAULT_TEMPLATE

public static final String DEFAULT_TEMPLATE
The default template string (used in the default constructor, it is equivalent to `PERCENT_TEMPLATE`).

Since:
  1.2
See Also:
  - Constant Field Values

## Constructor Details

### StandardPieLabelGenerator

public StandardPieLabelGenerator()
The default constructor, uses `DEFAULT_TEMPLATE` for the template string.

### StandardPieLabelGenerator

public StandardPieLabelGenerator(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 Details

### generateLabel

public String generateLabel(PieDataset3D dataset, Comparable<?> key)
Generates the label for one section in a pie chart.

Specified by:
  `generateLabel` in interface `PieLabelGenerator`
Parameters:
  `dataset` - the dataset (`null` not permitted).
  `key` - the key (`null` not permitted).
Returns:
  The label (never `null` for this implementation).

### equals

public boolean equals(Object obj)
Tests this label generator for equality with an arbitrary object.

Overrides:
  `equals` in class `Object`
Parameters:
  `obj` - the object (`null` permitted).
Returns:
  A boolean.

### hashCode

public int hashCode()

Overrides:
  `hashCode` in class `Object`