java.lang.Object
org.jfree.chart3d.label.StandardPieLabelGenerator
- All Implemented Interfaces:
Serializable
,PieLabelGenerator
A default implementation of the
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.
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
The default template string (used in the default constructor, it is equivalent toPERCENT_TEMPLATE
).static final String
A template string that will show the section key only.static final String
A template string that will show the section key followed by the percentage in brackets (with zero decimal places).static final String
A template string that will show the section key followed by the percentage in brackets (with two decimal places precision).static final String
A template string that will show the section key followed by the value in brackets (with zero decimal places precision).static final String
A template string that will show the section key followed by the value in brackets (with two decimal places precision). -
Constructor Summary
ConstructorsConstructorDescriptionThe default constructor, usesDEFAULT_TEMPLATE
for the template string.StandardPieLabelGenerator
(String template) Creates a new instance with the specified template string (which will be passed to ajava.util.Formatter
instance when generating labels). -
Method Summary
Modifier and TypeMethodDescriptionboolean
Tests this label generator for equality with an arbitrary object.generateLabel
(PieDataset3D dataset, Comparable<?> key) Generates the label for one section in a pie chart.int
hashCode()
-
Field Details
-
KEY_ONLY_TEMPLATE
A template string that will show the section key only.- Since:
- 1.2
- See Also:
-
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:
-
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:
-
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:
-
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:
-
DEFAULT_TEMPLATE
The default template string (used in the default constructor, it is equivalent toPERCENT_TEMPLATE
).- Since:
- 1.2
- See Also:
-
-
Constructor Details
-
StandardPieLabelGenerator
public StandardPieLabelGenerator()The default constructor, usesDEFAULT_TEMPLATE
for the template string. -
StandardPieLabelGenerator
Creates a new instance with the specified template string (which will be passed to ajava.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
Generates the label for one section in a pie chart.- Specified by:
generateLabel
in interfacePieLabelGenerator
- Parameters:
dataset
- the dataset (null
not permitted).key
- the key (null
not permitted).- Returns:
- The label (never
null
for this implementation).
-
equals
Tests this label generator for equality with an arbitrary object. -
hashCode
-