Package org.jfree.chart.labels
Class AbstractPieItemLabelGenerator
java.lang.Object
org.jfree.chart.labels.AbstractPieItemLabelGenerator
- All Implemented Interfaces:
Serializable
- Direct Known Subclasses:
StandardPieSectionLabelGenerator,StandardPieToolTipGenerator
A base class used for generating pie chart item labels.
- See Also:
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractPieItemLabelGenerator(String labelFormat, NumberFormat numberFormat, NumberFormat percentFormat) Creates an item label generator using the specified number formatters. -
Method Summary
Modifier and TypeMethodDescriptionclone()Returns an independent copy of the generator.protected Object[]createItemArray(PieDataset dataset, Comparable key) Creates the array of items that can be passed to theMessageFormatclass for creating labels.booleanTests the generator for equality with an arbitrary object.protected StringgenerateSectionLabel(PieDataset dataset, Comparable key) Generates a label for a pie section.Returns the label format string.Returns the number formatter.Returns the percent formatter.inthashCode()Returns a hash code for this instance.
-
Constructor Details
-
AbstractPieItemLabelGenerator
protected AbstractPieItemLabelGenerator(String labelFormat, NumberFormat numberFormat, NumberFormat percentFormat) Creates an item label generator using the specified number formatters.- Parameters:
labelFormat- the label format string (nullnot permitted).numberFormat- the format object for the values (nullnot permitted).percentFormat- the format object for the percentages (nullnot permitted).
-
-
Method Details
-
getLabelFormat
Returns the label format string.- Returns:
- The label format string (never
null).
-
getNumberFormat
Returns the number formatter.- Returns:
- The formatter (never
null).
-
getPercentFormat
Returns the percent formatter.- Returns:
- The formatter (never
null).
-
createItemArray
Creates the array of items that can be passed to theMessageFormatclass for creating labels. The returned array contains four values:- result[0] = the section key converted to a
String; - result[1] = the formatted data value;
- result[2] = the formatted percentage (of the total);
- result[3] = the formatted total value.
- Parameters:
dataset- the dataset (nullnot permitted).key- the key (nullnot permitted).- Returns:
- The items (never
null).
- result[0] = the section key converted to a
-
generateSectionLabel
Generates a label for a pie section.- Parameters:
dataset- the dataset (nullnot permitted).key- the section key (nullnot permitted).- Returns:
- The label (possibly
null).
-
equals
Tests the generator for equality with an arbitrary object. -
hashCode
Returns a hash code for this instance. -
clone
Returns an independent copy of the generator.- Overrides:
clonein classObject- Returns:
- A clone.
- Throws:
CloneNotSupportedException- should not happen.
-