org.jfree.chart.labels
Class StandardCategoryItemLabelGenerator

java.lang.Object
  extended byorg.jfree.chart.labels.StandardCategoryItemLabelGenerator
All Implemented Interfaces:
CategoryItemLabelGenerator, java.lang.Cloneable, java.io.Serializable

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

A standard tooltip generator for plots that use data from a CategoryDataset.

Author:
David Gilbert
See Also:
Serialized Form

Constructor Summary
StandardCategoryItemLabelGenerator()
          Creates a new tool tip generator with a default number formatter.
StandardCategoryItemLabelGenerator(java.text.DateFormat formatter)
          Creates a label generator with the specified date formatter.
StandardCategoryItemLabelGenerator(java.text.DateFormat formatter, boolean showSeriesNameInToolTips)
          Creates a label generator with the specified date formatter.
StandardCategoryItemLabelGenerator(java.text.NumberFormat formatter)
          Creates a tool tip generator with the specified number formatter.
StandardCategoryItemLabelGenerator(java.text.NumberFormat formatter, boolean showSeriesNameInToolTips)
          Creates a label generator with the specified number formatter.
 
Method Summary
 java.lang.Object clone()
          Returns an independent copy of the generator.
 boolean equals(java.lang.Object o)
          Tests if this object is equal to another.
 java.lang.String generateItemLabel(CategoryDataset data, int series, int category)
          Generates a value label for an item in the dataset.
 java.lang.String generateToolTip(CategoryDataset data, int series, int category)
          Generates a tooltip text item for a particular category within a series.
 java.text.DateFormat getDateFormat()
          Returns the date formatter.
 java.text.NumberFormat getNumberFormat()
          Returns the number formatter.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StandardCategoryItemLabelGenerator

public StandardCategoryItemLabelGenerator()
Creates a new tool tip generator with a default number formatter.


StandardCategoryItemLabelGenerator

public StandardCategoryItemLabelGenerator(java.text.NumberFormat formatter)
Creates a tool tip generator with the specified number formatter.

Parameters:
formatter - the number formatter.

StandardCategoryItemLabelGenerator

public StandardCategoryItemLabelGenerator(java.text.NumberFormat formatter,
                                          boolean showSeriesNameInToolTips)
Creates a label generator with the specified number formatter.

Parameters:
formatter - the number formatter.
showSeriesNameInToolTips - a flag that controls whether or not the series name is included in tooltips.

StandardCategoryItemLabelGenerator

public StandardCategoryItemLabelGenerator(java.text.DateFormat formatter)
Creates a label generator with the specified date formatter.

Parameters:
formatter - the date formatter.

StandardCategoryItemLabelGenerator

public StandardCategoryItemLabelGenerator(java.text.DateFormat formatter,
                                          boolean showSeriesNameInToolTips)
Creates a label generator with the specified date formatter.

Parameters:
formatter - the date formatter.
showSeriesNameInToolTips - a flag that controls whether or not the series name is included in tooltips.
Method Detail

getNumberFormat

public java.text.NumberFormat getNumberFormat()
Returns the number formatter.

Returns:
the number formatter.

getDateFormat

public java.text.DateFormat getDateFormat()
Returns the date formatter.

Returns:
the date formatter.

generateToolTip

public java.lang.String generateToolTip(CategoryDataset data,
                                        int series,
                                        int category)
Generates a tooltip text item for a particular category within a series.

Specified by:
generateToolTip in interface CategoryItemLabelGenerator
Parameters:
data - the dataset.
series - the series index (zero-based).
category - the category index (zero-based).
Returns:
the tooltip text or null if value is null.

generateItemLabel

public java.lang.String generateItemLabel(CategoryDataset data,
                                          int series,
                                          int category)
Generates a value label for an item in the dataset.

Specified by:
generateItemLabel in interface CategoryItemLabelGenerator
Parameters:
data - the dataset.
series - the series index (zero-based).
category - the category index (zero-based).
Returns:
The value label.

equals

public boolean equals(java.lang.Object o)
Tests if this object is equal to another.

Parameters:
o - the other object.
Returns:
A boolean.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns an independent copy of the generator.

Specified by:
clone in interface CategoryItemLabelGenerator
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - should not happen.