Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.jfree.chart.labels
Class StandardPieItemLabelGenerator

    java.lang.Object
      org.jfree.chart.labels.StandardPieItemLabelGenerator

All Implemented Interfaces:
  java.lang.Cloneable, PieSectionLabelGenerator, PieToolTipGenerator, java.io.Serializable

public class StandardPieItemLabelGenerator
extends java.lang.Object
implements PieToolTipGenerator, PieSectionLabelGenerator, java.lang.Cloneable, java.io.Serializable

A standard item label generator for plots that use data from a `PieDataset`.

For the label format, use {0} where the pie section key should be inserted, {1} for the absolute section value and {2} for the percent amount of the pie section, e.g. `"{0} = {1} ({2})"` will display as `apple = 120 (5%)`.

See Also:
  Serialized Form

Field Summary
`static java.lang.String` | `DEFAULT_SECTION_LABEL_FORMAT` The default section label format.
`static java.lang.String` | `DEFAULT_TOOLTIP_FORMAT` The default tooltip format.

Constructor Summary
`StandardPieItemLabelGenerator()` Creates an item label generator using default number formatters.
`StandardPieItemLabelGenerator(java.lang.String labelFormat)` Creates an item label generator.
`StandardPieItemLabelGenerator(java.lang.String labelFormat, java.text.NumberFormat numberFormat, java.text.NumberFormat percentFormat)` Creates an item label generator using the specified number formatters.

Method Summary
`java.lang.Object` | `clone()` Returns an independent copy of the generator.
`protected java.lang.Object[]` | `createItemArray(PieDataset dataset, java.lang.Comparable key)` Creates the array of items that can be passed to the `MessageFormat` class for creating labels.
`boolean` | `equals(java.lang.Object obj)` Tests the generator for equality with an arbitrary object.
`java.lang.String` | `generateSectionLabel(PieDataset dataset, java.lang.Comparable key)` Generates a label for a pie section.
`java.lang.String` | `generateToolTip(PieDataset dataset, java.lang.Comparable key)` Generates a tool tip text item for one section in a pie chart.
`java.text.NumberFormat` | `getNumberFormat()` Returns the number formatter.
`java.text.NumberFormat` | `getPercentFormat()` Returns the percent formatter.

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### DEFAULT_TOOLTIP_FORMAT

    public static final java.lang.String DEFAULT_TOOLTIP_FORMAT

  The default tooltip format.

  See Also:
    Constant Field Values

### DEFAULT_SECTION_LABEL_FORMAT

    public static final java.lang.String DEFAULT_SECTION_LABEL_FORMAT

  The default section label format.

  See Also:
    Constant Field Values

Constructor Detail

### StandardPieItemLabelGenerator

    public StandardPieItemLabelGenerator()

  Creates an item label generator using default number formatters.

### StandardPieItemLabelGenerator

    public StandardPieItemLabelGenerator(java.lang.String labelFormat)

  Creates an item label generator.

Parameters:
  `labelFormat` - the label format.

### StandardPieItemLabelGenerator

    public StandardPieItemLabelGenerator(java.lang.String labelFormat,
                                         java.text.NumberFormat numberFormat,
                                         java.text.NumberFormat percentFormat)

  Creates an item label generator using the specified number formatters.

Parameters:
  `labelFormat` - the label format string (`null` not permitted).
  `numberFormat` - the format object for the values (`null` not permitted).
  `percentFormat` - the format object for the percentages (`null` not permitted).

Method Detail

### getNumberFormat

    public java.text.NumberFormat getNumberFormat()

  Returns the number formatter.

  Returns:
    The formatter (never `null`).

### getPercentFormat

    public java.text.NumberFormat getPercentFormat()

  Returns the percent formatter.

  Returns:
    The formatter (never `null`).

### generateSectionLabel

    public java.lang.String generateSectionLabel(PieDataset dataset,
                                                 java.lang.Comparable key)

  Generates a label for a pie section.

  Specified by:
    `generateSectionLabel` in interface `PieSectionLabelGenerator`
  Parameters:
    `dataset` - the dataset (`null` not permitted).
    `key` - the section key (`null` not permitted).
  Returns:
    The label (possibly `null`).

### generateToolTip

    public java.lang.String generateToolTip(PieDataset dataset,
                                            java.lang.Comparable key)

  Generates a tool tip text item for one section in a pie chart.

  Specified by:
    `generateToolTip` in interface `PieToolTipGenerator`
  Parameters:
    `dataset` - the dataset (`null` not permitted).
    `key` - the section key (`null` not permitted).
  Returns:
    The tool tip text (possibly `null`).

### createItemArray

    protected java.lang.Object[] createItemArray(PieDataset dataset,
                                                 java.lang.Comparable key)

  Creates the array of items that can be passed to the `MessageFormat` class for creating labels.

  Parameters:
    `dataset` - the dataset (`null` not permitted).
    `key` - the key.
  Returns:
    The items (never `null`).

### equals

    public boolean equals(java.lang.Object obj)

  Tests the generator for equality with an arbitrary object.

  Parameters:
    `obj` - the object to test against (`null` permitted).
  Returns:
    A boolean.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Returns an independent copy of the generator.

  Returns:
    A clone.
  Throws:
    `java.lang.CloneNotSupportedException` - should not happen.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD