org.jfree.chart.plot

Class PiePlot

public class PiePlot extends Plot implements Cloneable, Serializable

A plot that displays data in the form of a pie chart, using data from any class that implements the PieDataset interface.

Special notes:

  1. the default starting point is 12 o'clock and the pie sections proceed in a clockwise direction, but these settings can be changed;
  2. negative values in the dataset are ignored;
  3. there are utility methods for creating a PieDataset from a CategoryDataset;

See Also: Plot PieDataset

Field Summary
static doubleDEFAULT_INTERIOR_GAP
The default interior gap.
static PaintDEFAULT_LABEL_BACKGROUND_PAINT
The default section label background paint.
static FontDEFAULT_LABEL_FONT
The default section label font.
static PaintDEFAULT_LABEL_OUTLINE_PAINT
The default section label outline paint.
static StrokeDEFAULT_LABEL_OUTLINE_STROKE
The default section label outline stroke.
static PaintDEFAULT_LABEL_PAINT
The default section label paint.
static PaintDEFAULT_LABEL_SHADOW_PAINT
The default section label shadow paint.
static doubleDEFAULT_MINIMUM_ARC_ANGLE_TO_DRAW
The default minimum arc angle to draw.
static doubleDEFAULT_START_ANGLE
The default starting angle for the pie chart.
protected static ResourceBundlelocalizationResources
The resourceBundle for the localization.
static doubleMAX_INTERIOR_GAP
The maximum interior gap (currently 40%).
Constructor Summary
PiePlot()
Creates a new plot.
PiePlot(PieDataset dataset)
Creates a plot that will draw a pie chart for the specified dataset.
Method Summary
Objectclone()
Returns a clone of the plot.
voiddraw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info)
Draws the plot on a Java 2D graphics device (such as the screen or a printer).
protected voiddrawItem(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass)
Draws a single data item.
protected voiddrawLabels(Graphics2D g2, List keys, double totalValue, Rectangle2D plotArea, Rectangle2D linkArea, PiePlotState state)
Draws the labels for the pie sections.
protected voiddrawLeftLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record)
Draws a section label on the left side of the pie chart.
protected voiddrawLeftLabels(KeyedValues leftKeys, Graphics2D g2, Rectangle2D plotArea, Rectangle2D linkArea, float maxLabelWidth, PiePlotState state)
Draws the left labels.
protected voiddrawPie(Graphics2D g2, Rectangle2D plotArea, PlotRenderingInfo info)
Draws the pie.
protected voiddrawRightLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record)
Draws a section label on the right side of the pie chart.
protected voiddrawRightLabels(KeyedValues keys, Graphics2D g2, Rectangle2D plotArea, Rectangle2D linkArea, float maxLabelWidth, PiePlotState state)
Draws the right labels.
protected voiddrawSimpleLabels(Graphics2D g2, List keys, double totalValue, Rectangle2D plotArea, Rectangle2D pieArea, PiePlotState state)
Draws the pie section labels in the simple form.
booleanequals(Object obj)
Tests this plot for equality with an arbitrary object.
protected Rectangle2DgetArcBounds(Rectangle2D unexploded, Rectangle2D exploded, double angle, double extent, double explodePercent)
Returns a rectangle that can be used to create a pie section (taking into account the amount by which the pie section is 'exploded').
PaintgetBaseSectionOutlinePaint()
Returns the base section paint.
StrokegetBaseSectionOutlineStroke()
Returns the base section stroke.
PaintgetBaseSectionPaint()
Returns the base section paint.
PieDatasetgetDataset()
Returns the dataset.
RotationgetDirection()
Returns the direction in which the pie sections are drawn (clockwise or anti-clockwise).
doublegetExplodePercent(Comparable key)
Returns the amount that the section with the specified key should be exploded.
doublegetExplodePercent(int section)
Returns the amount that a section should be 'exploded'.
booleangetIgnoreNullValues()
Returns the flag that controls whether null values in the dataset are ignored.
booleangetIgnoreZeroValues()
Returns the flag that controls whether zero values in the dataset are ignored.
doublegetInteriorGap()
Returns the interior gap, measured as a percentage of the available drawing space.
PaintgetLabelBackgroundPaint()
Returns the section label background paint.
AbstractPieLabelDistributorgetLabelDistributor()
Returns the object responsible for the vertical layout of the pie section labels.
FontgetLabelFont()
Returns the section label font.
doublegetLabelGap()
Returns the gap between the edge of the pie and the labels, expressed as a percentage of the plot width.
PieSectionLabelGeneratorgetLabelGenerator()
Returns the section label generator.
doublegetLabelLinkMargin()
Returns the margin (expressed as a percentage of the width or height) between the edge of the pie and the link point.
PaintgetLabelLinkPaint()
Returns the paint used for the lines that connect pie sections to their corresponding labels.
booleangetLabelLinksVisible()
Returns the flag that controls whether or not label linking lines are visible.
StrokegetLabelLinkStroke()
Returns the stroke used for the label linking lines.
PieLabelLinkStylegetLabelLinkStyle()
Returns the label link style.
PaintgetLabelOutlinePaint()
Returns the section label outline paint.
StrokegetLabelOutlineStroke()
Returns the section label outline stroke.
RectangleInsetsgetLabelPadding()
Returns the label padding.
PaintgetLabelPaint()
Returns the section label paint.
PaintgetLabelShadowPaint()
Returns the section label shadow paint.
LegendItemCollectiongetLegendItems()
Returns a collection of legend items for the pie chart.
ShapegetLegendItemShape()
Returns the shape used for legend items.
PieSectionLabelGeneratorgetLegendLabelGenerator()
Returns the legend label generator.
PieSectionLabelGeneratorgetLegendLabelToolTipGenerator()
Returns the legend label tool tip generator.
PieURLGeneratorgetLegendLabelURLGenerator()
Returns the legend label URL generator.
doublegetMaximumExplodePercent()
Returns the maximum explode percent.
doublegetMaximumLabelWidth()
Returns the maximum label width as a percentage of the plot width.
doublegetMinimumArcAngleToDraw()
Returns the minimum arc angle that will be drawn.
intgetPieIndex()
Returns the pie index (this is used by the MultiplePiePlot class to track subplots).
StringgetPlotType()
Returns a short string describing the type of plot.
protected ComparablegetSectionKey(int section)
Returns a key for the specified section.
PaintgetSectionOutlinePaint()
Returns the outline paint for ALL sections in the plot.
PaintgetSectionOutlinePaint(Comparable key)
Returns the outline paint associated with the specified key, or null if there is no paint associated with the key.
PaintgetSectionOutlinePaint(int section)
Returns the paint for the specified section.
booleangetSectionOutlinesVisible()
Returns the flag that controls whether or not the outline is drawn for each pie section.
StrokegetSectionOutlineStroke()
Returns the outline stroke for ALL sections in the plot.
StrokegetSectionOutlineStroke(Comparable key)
Returns the outline stroke associated with the specified key, or null if there is no stroke associated with the key.
StrokegetSectionOutlineStroke(int section)
Returns the stroke for the specified section.
PaintgetSectionPaint()
Returns the paint for ALL sections in the plot.
PaintgetSectionPaint(Comparable key)
Returns the paint associated with the specified key, or null if there is no paint associated with the key.
PaintgetSectionPaint(int section)
Returns the paint for the specified section.
PaintgetShadowPaint()
Returns the shadow paint.
doublegetShadowXOffset()
Returns the x-offset for the shadow effect.
doublegetShadowYOffset()
Returns the y-offset for the shadow effect.
RectangleInsetsgetSimpleLabelOffset()
Returns the offset used for the simple labels, if they are displayed.
booleangetSimpleLabels()
Returns the flag that controls whether simple or extended labels are displayed on the plot.
doublegetStartAngle()
Returns the start angle for the first pie section.
PieToolTipGeneratorgetToolTipGenerator()
Returns the tool tip generator, an object that is responsible for generating the text items used for tool tips by the plot.
PieURLGeneratorgetURLGenerator()
Returns the URL generator.
PiePlotStateinitialise(Graphics2D g2, Rectangle2D plotArea, PiePlot plot, Integer index, PlotRenderingInfo info)
Initialises the drawing procedure.
booleanisCircular()
Returns a flag indicating whether the pie chart is circular, or stretched into an elliptical shape.
protected PaintlookupSectionOutlinePaint(Comparable key)
Returns the outline paint for the specified section.
protected PaintlookupSectionOutlinePaint(Comparable key, boolean autoPopulate)
Returns the outline paint for the specified section.
protected StrokelookupSectionOutlineStroke(Comparable key)
Returns the outline stroke for the specified section.
protected StrokelookupSectionOutlineStroke(Comparable key, boolean autoPopulate)
Returns the outline stroke for the specified section.
protected PaintlookupSectionPaint(Comparable key)
Returns the paint for the specified section.
protected PaintlookupSectionPaint(Comparable key, boolean autoPopulate)
Returns the paint for the specified section.
voidsetBaseSectionOutlinePaint(Paint paint)
Sets the base section paint.
voidsetBaseSectionOutlineStroke(Stroke stroke)
Sets the base section stroke.
voidsetBaseSectionPaint(Paint paint)
Sets the base section paint and sends a PlotChangeEvent to all registered listeners.
voidsetCircular(boolean flag)
A flag indicating whether the pie chart is circular, or stretched into an elliptical shape.
voidsetCircular(boolean circular, boolean notify)
Sets the circular attribute and, if requested, sends a PlotChangeEvent to all registered listeners.
voidsetDataset(PieDataset dataset)
Sets the dataset and sends a DatasetChangeEvent to 'this'.
voidsetDirection(Rotation direction)
Sets the direction in which the pie sections are drawn and sends a PlotChangeEvent to all registered listeners.
voidsetExplodePercent(Comparable key, double percent)
Sets the amount that a pie section should be exploded and sends a PlotChangeEvent to all registered listeners.
voidsetExplodePercent(int section, double percent)
Sets the amount that a pie section should be exploded and sends a PlotChangeEvent to all registered listeners.
voidsetIgnoreNullValues(boolean flag)
Sets a flag that controls whether null values are ignored, and sends a PlotChangeEvent to all registered listeners.
voidsetIgnoreZeroValues(boolean flag)
Sets a flag that controls whether zero values are ignored, and sends a PlotChangeEvent to all registered listeners.
voidsetInteriorGap(double percent)
Sets the interior gap and sends a PlotChangeEvent to all registered listeners.
voidsetLabelBackgroundPaint(Paint paint)
Sets the section label background paint and sends a PlotChangeEvent to all registered listeners.
voidsetLabelDistributor(AbstractPieLabelDistributor distributor)
Sets the label distributor and sends a PlotChangeEvent to all registered listeners.
voidsetLabelFont(Font font)
Sets the section label font and sends a PlotChangeEvent to all registered listeners.
voidsetLabelGap(double gap)
Sets the gap between the edge of the pie and the labels (expressed as a percentage of the plot width) and sends a PlotChangeEvent to all registered listeners.
voidsetLabelGenerator(PieSectionLabelGenerator generator)
Sets the section label generator and sends a PlotChangeEvent to all registered listeners.
voidsetLabelLinkMargin(double margin)
Sets the link margin and sends a PlotChangeEvent to all registered listeners.
voidsetLabelLinkPaint(Paint paint)
Sets the paint used for the lines that connect pie sections to their corresponding labels, and sends a PlotChangeEvent to all registered listeners.
voidsetLabelLinksVisible(boolean visible)
Sets the flag that controls whether or not label linking lines are visible and sends a PlotChangeEvent to all registered listeners.
voidsetLabelLinkStroke(Stroke stroke)
Sets the link stroke and sends a PlotChangeEvent to all registered listeners.
voidsetLabelLinkStyle(PieLabelLinkStyle style)
Sets the label link style and sends a PlotChangeEvent to all registered listeners.
voidsetLabelOutlinePaint(Paint paint)
Sets the section label outline paint and sends a PlotChangeEvent to all registered listeners.
voidsetLabelOutlineStroke(Stroke stroke)
Sets the section label outline stroke and sends a PlotChangeEvent to all registered listeners.
voidsetLabelPadding(RectangleInsets padding)
Sets the padding between each label and its outline and sends a PlotChangeEvent to all registered listeners.
voidsetLabelPaint(Paint paint)
Sets the section label paint and sends a PlotChangeEvent to all registered listeners.
voidsetLabelShadowPaint(Paint paint)
Sets the section label shadow paint and sends a PlotChangeEvent to all registered listeners.
voidsetLegendItemShape(Shape shape)
Sets the shape used for legend items and sends a PlotChangeEvent to all registered listeners.
voidsetLegendLabelGenerator(PieSectionLabelGenerator generator)
Sets the legend label generator and sends a PlotChangeEvent to all registered listeners.
voidsetLegendLabelToolTipGenerator(PieSectionLabelGenerator generator)
Sets the legend label tool tip generator and sends a PlotChangeEvent to all registered listeners.
voidsetLegendLabelURLGenerator(PieURLGenerator generator)
Sets the legend label URL generator and sends a PlotChangeEvent to all registered listeners.
voidsetMaximumLabelWidth(double width)
Sets the maximum label width as a percentage of the plot width and sends a PlotChangeEvent to all registered listeners.
voidsetMinimumArcAngleToDraw(double angle)
Sets the minimum arc angle that will be drawn.
voidsetPieIndex(int index)
Sets the pie index (this is used by the MultiplePiePlot class to track subplots).
voidsetSectionOutlinePaint(Paint paint)
Sets the outline paint for ALL sections in the plot.
voidsetSectionOutlinePaint(Comparable key, Paint paint)
Sets the outline paint associated with the specified key, and sends a PlotChangeEvent to all registered listeners.
voidsetSectionOutlinePaint(int section, Paint paint)
Sets the paint used to fill a section of the pie and sends a PlotChangeEvent to all registered listeners.
voidsetSectionOutlinesVisible(boolean visible)
Sets the flag that controls whether or not the outline is drawn for each pie section, and sends a PlotChangeEvent to all registered listeners.
voidsetSectionOutlineStroke(Stroke stroke)
Sets the outline stroke for ALL sections in the plot.
voidsetSectionOutlineStroke(Comparable key, Stroke stroke)
Sets the outline stroke associated with the specified key, and sends a PlotChangeEvent to all registered listeners.
voidsetSectionOutlineStroke(int section, Stroke stroke)
Sets the stroke used to fill a section of the pie and sends a PlotChangeEvent to all registered listeners.
voidsetSectionPaint(Paint paint)
Sets the paint for ALL sections in the plot.
voidsetSectionPaint(Comparable key, Paint paint)
Sets the paint associated with the specified key, and sends a PlotChangeEvent to all registered listeners.
voidsetSectionPaint(int section, Paint paint)
Sets the paint used to fill a section of the pie and sends a PlotChangeEvent to all registered listeners.
voidsetShadowPaint(Paint paint)
Sets the shadow paint and sends a PlotChangeEvent to all registered listeners.
voidsetShadowXOffset(double offset)
Sets the x-offset for the shadow effect and sends a PlotChangeEvent to all registered listeners.
voidsetShadowYOffset(double offset)
Sets the y-offset for the shadow effect and sends a PlotChangeEvent to all registered listeners.
voidsetSimpleLabelOffset(RectangleInsets offset)
Sets the offset for the simple labels and sends a PlotChangeEvent to all registered listeners.
voidsetSimpleLabels(boolean simple)
Sets the flag that controls whether simple or extended labels are displayed on the plot, and sends a PlotChangeEvent to all registered listeners.
voidsetStartAngle(double angle)
Sets the starting angle and sends a PlotChangeEvent to all registered listeners.
voidsetToolTipGenerator(PieToolTipGenerator generator)
Sets the tool tip generator and sends a PlotChangeEvent to all registered listeners.
voidsetURLGenerator(PieURLGenerator generator)
Sets the URL generator and sends a PlotChangeEvent to all registered listeners.

Field Detail

DEFAULT_INTERIOR_GAP

public static final double DEFAULT_INTERIOR_GAP
The default interior gap.

DEFAULT_LABEL_BACKGROUND_PAINT

public static final Paint DEFAULT_LABEL_BACKGROUND_PAINT
The default section label background paint.

DEFAULT_LABEL_FONT

public static final Font DEFAULT_LABEL_FONT
The default section label font.

DEFAULT_LABEL_OUTLINE_PAINT

public static final Paint DEFAULT_LABEL_OUTLINE_PAINT
The default section label outline paint.

DEFAULT_LABEL_OUTLINE_STROKE

public static final Stroke DEFAULT_LABEL_OUTLINE_STROKE
The default section label outline stroke.

DEFAULT_LABEL_PAINT

public static final Paint DEFAULT_LABEL_PAINT
The default section label paint.

DEFAULT_LABEL_SHADOW_PAINT

public static final Paint DEFAULT_LABEL_SHADOW_PAINT
The default section label shadow paint.

DEFAULT_MINIMUM_ARC_ANGLE_TO_DRAW

public static final double DEFAULT_MINIMUM_ARC_ANGLE_TO_DRAW
The default minimum arc angle to draw.

DEFAULT_START_ANGLE

public static final double DEFAULT_START_ANGLE
The default starting angle for the pie chart.

localizationResources

protected static ResourceBundle localizationResources
The resourceBundle for the localization.

MAX_INTERIOR_GAP

public static final double MAX_INTERIOR_GAP
The maximum interior gap (currently 40%).

Constructor Detail

PiePlot

public PiePlot()
Creates a new plot. The dataset is initially set to null.

PiePlot

public PiePlot(PieDataset dataset)
Creates a plot that will draw a pie chart for the specified dataset.

Parameters: dataset the dataset (null permitted).

Method Detail

clone

public Object clone()
Returns a clone of the plot.

Returns: A clone.

Throws: CloneNotSupportedException if some component of the plot does not support cloning.

draw

public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info)
Draws the plot on a Java 2D graphics device (such as the screen or a printer).

Parameters: g2 the graphics device. area the area within which the plot should be drawn. anchor the anchor point (null permitted). parentState the state from the parent plot, if there is one. info collects info about the drawing (null permitted).

drawItem

protected void drawItem(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass)
Draws a single data item.

Parameters: g2 the graphics device (null not permitted). section the section index. dataArea the data plot area. state state information for one chart. currentPass the current pass index.

drawLabels

protected void drawLabels(Graphics2D g2, List keys, double totalValue, Rectangle2D plotArea, Rectangle2D linkArea, PiePlotState state)
Draws the labels for the pie sections.

Parameters: g2 the graphics device. keys the keys. totalValue the total value. plotArea the plot area. linkArea the link area. state the state.

drawLeftLabel

protected void drawLeftLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record)
Draws a section label on the left side of the pie chart.

Parameters: g2 the graphics device. state the state. record the label record.

drawLeftLabels

protected void drawLeftLabels(KeyedValues leftKeys, Graphics2D g2, Rectangle2D plotArea, Rectangle2D linkArea, float maxLabelWidth, PiePlotState state)
Draws the left labels.

Parameters: leftKeys a collection of keys and angles (to the middle of the section, in degrees) for the sections on the left side of the plot. g2 the graphics device. plotArea the plot area. linkArea the link area. maxLabelWidth the maximum label width. state the state.

drawPie

protected void drawPie(Graphics2D g2, Rectangle2D plotArea, PlotRenderingInfo info)
Draws the pie.

Parameters: g2 the graphics device. plotArea the plot area. info chart rendering info.

drawRightLabel

protected void drawRightLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record)
Draws a section label on the right side of the pie chart.

Parameters: g2 the graphics device. state the state. record the label record.

drawRightLabels

protected void drawRightLabels(KeyedValues keys, Graphics2D g2, Rectangle2D plotArea, Rectangle2D linkArea, float maxLabelWidth, PiePlotState state)
Draws the right labels.

Parameters: keys the keys. g2 the graphics device. plotArea the plot area. linkArea the link area. maxLabelWidth the maximum label width. state the state.

drawSimpleLabels

protected void drawSimpleLabels(Graphics2D g2, List keys, double totalValue, Rectangle2D plotArea, Rectangle2D pieArea, PiePlotState state)
Draws the pie section labels in the simple form.

Parameters: g2 the graphics device. keys the section keys. totalValue the total value for all sections in the pie. plotArea the plot area. pieArea the area containing the pie. state the plot state.

Since: 1.0.7

equals

public boolean equals(Object obj)
Tests this plot for equality with an arbitrary object. Note that the plot's dataset is NOT included in the test for equality.

Parameters: obj the object to test against (null permitted).

Returns: true or false.

getArcBounds

protected Rectangle2D getArcBounds(Rectangle2D unexploded, Rectangle2D exploded, double angle, double extent, double explodePercent)
Returns a rectangle that can be used to create a pie section (taking into account the amount by which the pie section is 'exploded').

Parameters: unexploded the area inside which the unexploded pie sections are drawn. exploded the area inside which the exploded pie sections are drawn. angle the start angle. extent the extent of the arc. explodePercent the amount by which the pie section is exploded.

Returns: A rectangle that can be used to create a pie section.

getBaseSectionOutlinePaint

public Paint getBaseSectionOutlinePaint()
Returns the base section paint. This is used when no other paint is available.

Returns: The paint (never null).

See Also: setBaseSectionOutlinePaint

getBaseSectionOutlineStroke

public Stroke getBaseSectionOutlineStroke()
Returns the base section stroke. This is used when no other stroke is available.

Returns: The stroke (never null).

See Also: setBaseSectionOutlineStroke

getBaseSectionPaint

public Paint getBaseSectionPaint()
Returns the base section paint. This is used when no other paint is defined, which is rare. The default value is Color.gray.

Returns: The paint (never null).

See Also: setBaseSectionPaint

getDataset

public PieDataset getDataset()
Returns the dataset.

Returns: The dataset (possibly null).

See Also: setDataset

getDirection

public Rotation getDirection()
Returns the direction in which the pie sections are drawn (clockwise or anti-clockwise).

Returns: The direction (never null).

See Also: setDirection

getExplodePercent

public double getExplodePercent(Comparable key)
Returns the amount that the section with the specified key should be exploded.

Parameters: key the key (null not permitted).

Returns: The amount that the section with the specified key should be exploded.

Throws: IllegalArgumentException if key is null.

Since: 1.0.3

See Also: PiePlot

getExplodePercent

public double getExplodePercent(int section)

Deprecated: Use getExplodePercent instead.

Returns the amount that a section should be 'exploded'.

Parameters: section the section number.

Returns: The amount that a section should be 'exploded'.

getIgnoreNullValues

public boolean getIgnoreNullValues()
Returns the flag that controls whether null values in the dataset are ignored.

Returns: A boolean.

See Also: PiePlot

getIgnoreZeroValues

public boolean getIgnoreZeroValues()
Returns the flag that controls whether zero values in the dataset are ignored.

Returns: A boolean.

See Also: PiePlot

getInteriorGap

public double getInteriorGap()
Returns the interior gap, measured as a percentage of the available drawing space.

Returns: The gap (as a percentage of the available drawing space).

See Also: PiePlot

getLabelBackgroundPaint

public Paint getLabelBackgroundPaint()
Returns the section label background paint.

Returns: The paint (possibly null).

See Also: setLabelBackgroundPaint

getLabelDistributor

public AbstractPieLabelDistributor getLabelDistributor()
Returns the object responsible for the vertical layout of the pie section labels.

Returns: The label distributor (never null).

Since: 1.0.6

getLabelFont

public Font getLabelFont()
Returns the section label font.

Returns: The font (never null).

See Also: setLabelFont

getLabelGap

public double getLabelGap()
Returns the gap between the edge of the pie and the labels, expressed as a percentage of the plot width.

Returns: The gap (a percentage, where 0.05 = five percent).

See Also: PiePlot

getLabelGenerator

public PieSectionLabelGenerator getLabelGenerator()
Returns the section label generator.

Returns: The generator (possibly null).

See Also: setLabelGenerator

getLabelLinkMargin

public double getLabelLinkMargin()
Returns the margin (expressed as a percentage of the width or height) between the edge of the pie and the link point.

Returns: The link margin (as a percentage, where 0.05 is five percent).

See Also: PiePlot

getLabelLinkPaint

public Paint getLabelLinkPaint()
Returns the paint used for the lines that connect pie sections to their corresponding labels.

Returns: The paint (never null).

See Also: setLabelLinkPaint

getLabelLinksVisible

public boolean getLabelLinksVisible()
Returns the flag that controls whether or not label linking lines are visible.

Returns: A boolean.

See Also: PiePlot

getLabelLinkStroke

public Stroke getLabelLinkStroke()
Returns the stroke used for the label linking lines.

Returns: The stroke.

See Also: setLabelLinkStroke

getLabelLinkStyle

public PieLabelLinkStyle getLabelLinkStyle()
Returns the label link style.

Returns: The label link style (never null).

Since: 1.0.10

See Also:

getLabelOutlinePaint

public Paint getLabelOutlinePaint()
Returns the section label outline paint.

Returns: The paint (possibly null).

See Also: setLabelOutlinePaint

getLabelOutlineStroke

public Stroke getLabelOutlineStroke()
Returns the section label outline stroke.

Returns: The stroke (possibly null).

See Also: setLabelOutlineStroke

getLabelPadding

public RectangleInsets getLabelPadding()
Returns the label padding.

Returns: The label padding (never null).

Since: 1.0.7

See Also: setLabelPadding

getLabelPaint

public Paint getLabelPaint()
Returns the section label paint.

Returns: The paint (never null).

See Also: setLabelPaint

getLabelShadowPaint

public Paint getLabelShadowPaint()
Returns the section label shadow paint.

Returns: The paint (possibly null).

See Also: setLabelShadowPaint

getLegendItems

public LegendItemCollection getLegendItems()
Returns a collection of legend items for the pie chart.

Returns: The legend items (never null).

getLegendItemShape

public Shape getLegendItemShape()
Returns the shape used for legend items.

Returns: The shape (never null).

See Also: setLegendItemShape

getLegendLabelGenerator

public PieSectionLabelGenerator getLegendLabelGenerator()
Returns the legend label generator.

Returns: The legend label generator (never null).

See Also: setLegendLabelGenerator

getLegendLabelToolTipGenerator

public PieSectionLabelGenerator getLegendLabelToolTipGenerator()
Returns the legend label tool tip generator.

Returns: The legend label tool tip generator (possibly null).

See Also: setLegendLabelToolTipGenerator

getLegendLabelURLGenerator

public PieURLGenerator getLegendLabelURLGenerator()
Returns the legend label URL generator.

Returns: The legend label URL generator (possibly null).

Since: 1.0.4

See Also:

getMaximumExplodePercent

public double getMaximumExplodePercent()
Returns the maximum explode percent.

Returns: The percent.

getMaximumLabelWidth

public double getMaximumLabelWidth()
Returns the maximum label width as a percentage of the plot width.

Returns: The width (a percentage, where 0.20 = 20 percent).

See Also: PiePlot

getMinimumArcAngleToDraw

public double getMinimumArcAngleToDraw()
Returns the minimum arc angle that will be drawn. Pie sections for an angle smaller than this are not drawn, to avoid a JDK bug.

Returns: The minimum angle.

See Also: PiePlot

getPieIndex

public int getPieIndex()
Returns the pie index (this is used by the MultiplePiePlot class to track subplots).

Returns: The pie index.

See Also: PiePlot

getPlotType

public String getPlotType()
Returns a short string describing the type of plot.

Returns: The plot type.

getSectionKey

protected Comparable getSectionKey(int section)
Returns a key for the specified section. If there is no such section in the dataset, we generate a key. This is to provide some backward compatibility for the (now deprecated) methods that get/set attributes based on section indices. The preferred way of doing this now is to link the attributes directly to the section key (there are new methods for this, starting from version 1.0.3).

Parameters: section the section index.

Returns: The key.

Since: 1.0.3

getSectionOutlinePaint

public Paint getSectionOutlinePaint()

Deprecated: Use getSectionOutlinePaint and getBaseSectionOutlinePaint. Deprecated as of version 1.0.6.

Returns the outline paint for ALL sections in the plot.

Returns: The paint (possibly null).

See Also:

getSectionOutlinePaint

public Paint getSectionOutlinePaint(Comparable key)
Returns the outline paint associated with the specified key, or null if there is no paint associated with the key.

Parameters: key the key (null not permitted).

Returns: The paint associated with the specified key, or null.

Throws: IllegalArgumentException if key is null.

Since: 1.0.3

See Also:

getSectionOutlinePaint

public Paint getSectionOutlinePaint(int section)

Deprecated: Use getSectionOutlinePaint instead.

Returns the paint for the specified section.

Parameters: section the section index (zero-based).

Returns: The paint (possibly null).

getSectionOutlinesVisible

public boolean getSectionOutlinesVisible()
Returns the flag that controls whether or not the outline is drawn for each pie section.

Returns: The flag that controls whether or not the outline is drawn for each pie section.

See Also: PiePlot

getSectionOutlineStroke

public Stroke getSectionOutlineStroke()

Deprecated: Use getSectionOutlineStroke and getBaseSectionOutlineStroke. Deprecated as of version 1.0.6.

Returns the outline stroke for ALL sections in the plot.

Returns: The stroke (possibly null).

See Also:

getSectionOutlineStroke

public Stroke getSectionOutlineStroke(Comparable key)
Returns the outline stroke associated with the specified key, or null if there is no stroke associated with the key.

Parameters: key the key (null not permitted).

Returns: The stroke associated with the specified key, or null.

Throws: IllegalArgumentException if key is null.

Since: 1.0.3

See Also:

getSectionOutlineStroke

public Stroke getSectionOutlineStroke(int section)

Deprecated: Use getSectionOutlineStroke instead.

Returns the stroke for the specified section.

Parameters: section the section index (zero-based).

Returns: The stroke (possibly null).

getSectionPaint

public Paint getSectionPaint()

Deprecated: Use getSectionPaint and getBaseSectionPaint. Deprecated as of version 1.0.6.

Returns the paint for ALL sections in the plot.

Returns: The paint (possibly null).

See Also:

getSectionPaint

public Paint getSectionPaint(Comparable key)
Returns the paint associated with the specified key, or null if there is no paint associated with the key.

Parameters: key the key (null not permitted).

Returns: The paint associated with the specified key, or null.

Throws: IllegalArgumentException if key is null.

Since: 1.0.3

See Also:

getSectionPaint

public Paint getSectionPaint(int section)

Deprecated: Use getSectionPaint instead.

Returns the paint for the specified section.

Parameters: section the section index (zero-based).

Returns: The paint (never null).

getShadowPaint

public Paint getShadowPaint()
Returns the shadow paint.

Returns: The paint (possibly null).

See Also: setShadowPaint

getShadowXOffset

public double getShadowXOffset()
Returns the x-offset for the shadow effect.

Returns: The offset (in Java2D units).

See Also: PiePlot

getShadowYOffset

public double getShadowYOffset()
Returns the y-offset for the shadow effect.

Returns: The offset (in Java2D units).

See Also: PiePlot

getSimpleLabelOffset

public RectangleInsets getSimpleLabelOffset()
Returns the offset used for the simple labels, if they are displayed.

Returns: The offset (never null).

Since: 1.0.7

See Also: setSimpleLabelOffset

getSimpleLabels

public boolean getSimpleLabels()
Returns the flag that controls whether simple or extended labels are displayed on the plot.

Returns: A boolean.

Since: 1.0.7

getStartAngle

public double getStartAngle()
Returns the start angle for the first pie section. This is measured in degrees starting from 3 o'clock and measuring anti-clockwise.

Returns: The start angle.

See Also: PiePlot

getToolTipGenerator

public PieToolTipGenerator getToolTipGenerator()
Returns the tool tip generator, an object that is responsible for generating the text items used for tool tips by the plot. If the generator is null, no tool tips will be created.

Returns: The generator (possibly null).

See Also: setToolTipGenerator

getURLGenerator

public PieURLGenerator getURLGenerator()
Returns the URL generator.

Returns: The generator (possibly null).

See Also: setURLGenerator

initialise

public PiePlotState initialise(Graphics2D g2, Rectangle2D plotArea, PiePlot plot, Integer index, PlotRenderingInfo info)
Initialises the drawing procedure. This method will be called before the first item is rendered, giving the plot an opportunity to initialise any state information it wants to maintain.

Parameters: g2 the graphics device. plotArea the plot area (null not permitted). plot the plot. index the secondary index (null for primary renderer). info collects chart rendering information for return to caller.

Returns: A state object (maintains state information relevant to one chart drawing).

isCircular

public boolean isCircular()
Returns a flag indicating whether the pie chart is circular, or stretched into an elliptical shape.

Returns: A flag indicating whether the pie chart is circular.

See Also: PiePlot

lookupSectionOutlinePaint

protected Paint lookupSectionOutlinePaint(Comparable key)
Returns the outline paint for the specified section. This is equivalent to lookupSectionPaint(section, false).

Parameters: key the section key.

Returns: The paint for the specified section.

Since: 1.0.3

See Also: PiePlot

lookupSectionOutlinePaint

protected Paint lookupSectionOutlinePaint(Comparable key, boolean autoPopulate)
Returns the outline paint for the specified section. The lookup involves these steps:

Parameters: key the section key. autoPopulate a flag that controls whether the drawing supplier is used to auto-populate the section outline paint settings.

Returns: The paint.

Since: 1.0.3

lookupSectionOutlineStroke

protected Stroke lookupSectionOutlineStroke(Comparable key)
Returns the outline stroke for the specified section. This is equivalent to lookupSectionOutlineStroke(section, false).

Parameters: key the section key.

Returns: The stroke for the specified section.

Since: 1.0.3

See Also: PiePlot

lookupSectionOutlineStroke

protected Stroke lookupSectionOutlineStroke(Comparable key, boolean autoPopulate)
Returns the outline stroke for the specified section. The lookup involves these steps:

Parameters: key the section key. autoPopulate a flag that controls whether the drawing supplier is used to auto-populate the section outline stroke settings.

Returns: The stroke.

Since: 1.0.3

lookupSectionPaint

protected Paint lookupSectionPaint(Comparable key)
Returns the paint for the specified section. This is equivalent to lookupSectionPaint(section, false).

Parameters: key the section key.

Returns: The paint for the specified section.

Since: 1.0.3

See Also: PiePlot

lookupSectionPaint

protected Paint lookupSectionPaint(Comparable key, boolean autoPopulate)
Returns the paint for the specified section. The lookup involves these steps:

Parameters: key the section key. autoPopulate a flag that controls whether the drawing supplier is used to auto-populate the section paint settings.

Returns: The paint.

Since: 1.0.3

setBaseSectionOutlinePaint

public void setBaseSectionOutlinePaint(Paint paint)
Sets the base section paint.

Parameters: paint the paint (null not permitted).

See Also: getBaseSectionOutlinePaint

setBaseSectionOutlineStroke

public void setBaseSectionOutlineStroke(Stroke stroke)
Sets the base section stroke.

Parameters: stroke the stroke (null not permitted).

See Also: getBaseSectionOutlineStroke

setBaseSectionPaint

public void setBaseSectionPaint(Paint paint)
Sets the base section paint and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getBaseSectionPaint

setCircular

public void setCircular(boolean flag)
A flag indicating whether the pie chart is circular, or stretched into an elliptical shape.

Parameters: flag the new value.

See Also: isCircular

setCircular

public void setCircular(boolean circular, boolean notify)
Sets the circular attribute and, if requested, sends a PlotChangeEvent to all registered listeners.

Parameters: circular the new value of the flag. notify notify listeners?

See Also: isCircular

setDataset

public void setDataset(PieDataset dataset)
Sets the dataset and sends a DatasetChangeEvent to 'this'.

Parameters: dataset the dataset (null permitted).

See Also: getDataset

setDirection

public void setDirection(Rotation direction)
Sets the direction in which the pie sections are drawn and sends a PlotChangeEvent to all registered listeners.

Parameters: direction the direction (null not permitted).

See Also: getDirection

setExplodePercent

public void setExplodePercent(Comparable key, double percent)
Sets the amount that a pie section should be exploded and sends a PlotChangeEvent to all registered listeners.

Parameters: key the section key (null not permitted). percent the explode percentage (0.30 = 30 percent).

Since: 1.0.3

See Also: getExplodePercent

setExplodePercent

public void setExplodePercent(int section, double percent)

Deprecated: Use PiePlot instead.

Sets the amount that a pie section should be exploded and sends a PlotChangeEvent to all registered listeners.

Parameters: section the section index. percent the explode percentage (0.30 = 30 percent).

setIgnoreNullValues

public void setIgnoreNullValues(boolean flag)
Sets a flag that controls whether null values are ignored, and sends a PlotChangeEvent to all registered listeners. At present, this only affects whether or not the key is presented in the legend.

Parameters: flag the flag.

See Also: getIgnoreNullValues PiePlot

setIgnoreZeroValues

public void setIgnoreZeroValues(boolean flag)
Sets a flag that controls whether zero values are ignored, and sends a PlotChangeEvent to all registered listeners. This only affects whether or not a label appears for the non-visible pie section.

Parameters: flag the flag.

See Also: getIgnoreZeroValues PiePlot

setInteriorGap

public void setInteriorGap(double percent)
Sets the interior gap and sends a PlotChangeEvent to all registered listeners. This controls the space between the edges of the pie plot and the plot area itself (the region where the section labels appear).

Parameters: percent the gap (as a percentage of the available drawing space).

See Also: getInteriorGap

setLabelBackgroundPaint

public void setLabelBackgroundPaint(Paint paint)
Sets the section label background paint and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null permitted).

See Also: getLabelBackgroundPaint

setLabelDistributor

public void setLabelDistributor(AbstractPieLabelDistributor distributor)
Sets the label distributor and sends a PlotChangeEvent to all registered listeners.

Parameters: distributor the distributor (null not permitted).

Since: 1.0.6

setLabelFont

public void setLabelFont(Font font)
Sets the section label font and sends a PlotChangeEvent to all registered listeners.

Parameters: font the font (null not permitted).

See Also: getLabelFont

setLabelGap

public void setLabelGap(double gap)
Sets the gap between the edge of the pie and the labels (expressed as a percentage of the plot width) and sends a PlotChangeEvent to all registered listeners.

Parameters: gap the gap (a percentage, where 0.05 = five percent).

See Also: getLabelGap

setLabelGenerator

public void setLabelGenerator(PieSectionLabelGenerator generator)
Sets the section label generator and sends a PlotChangeEvent to all registered listeners.

Parameters: generator the generator (null permitted).

See Also: getLabelGenerator

setLabelLinkMargin

public void setLabelLinkMargin(double margin)
Sets the link margin and sends a PlotChangeEvent to all registered listeners.

Parameters: margin the margin.

See Also: getLabelLinkMargin

setLabelLinkPaint

public void setLabelLinkPaint(Paint paint)
Sets the paint used for the lines that connect pie sections to their corresponding labels, and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getLabelLinkPaint

setLabelLinksVisible

public void setLabelLinksVisible(boolean visible)
Sets the flag that controls whether or not label linking lines are visible and sends a PlotChangeEvent to all registered listeners. Please take care when hiding the linking lines - depending on the data values, the labels can be displayed some distance away from the corresponding pie section.

Parameters: visible the flag.

See Also: getLabelLinksVisible

setLabelLinkStroke

public void setLabelLinkStroke(Stroke stroke)
Sets the link stroke and sends a PlotChangeEvent to all registered listeners.

Parameters: stroke the stroke.

See Also: getLabelLinkStroke

setLabelLinkStyle

public void setLabelLinkStyle(PieLabelLinkStyle style)
Sets the label link style and sends a PlotChangeEvent to all registered listeners.

Parameters: style the new style (null not permitted).

Since: 1.0.10

See Also:

setLabelOutlinePaint

public void setLabelOutlinePaint(Paint paint)
Sets the section label outline paint and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null permitted).

See Also: getLabelOutlinePaint

setLabelOutlineStroke

public void setLabelOutlineStroke(Stroke stroke)
Sets the section label outline stroke and sends a PlotChangeEvent to all registered listeners.

Parameters: stroke the stroke (null permitted).

See Also: getLabelOutlineStroke

setLabelPadding

public void setLabelPadding(RectangleInsets padding)
Sets the padding between each label and its outline and sends a PlotChangeEvent to all registered listeners.

Parameters: padding the padding (null not permitted).

Since: 1.0.7

See Also: getLabelPadding

setLabelPaint

public void setLabelPaint(Paint paint)
Sets the section label paint and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getLabelPaint

setLabelShadowPaint

public void setLabelShadowPaint(Paint paint)
Sets the section label shadow paint and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null permitted).

See Also: getLabelShadowPaint

setLegendItemShape

public void setLegendItemShape(Shape shape)
Sets the shape used for legend items and sends a PlotChangeEvent to all registered listeners.

Parameters: shape the shape (null not permitted).

See Also: getLegendItemShape

setLegendLabelGenerator

public void setLegendLabelGenerator(PieSectionLabelGenerator generator)
Sets the legend label generator and sends a PlotChangeEvent to all registered listeners.

Parameters: generator the generator (null not permitted).

See Also: getLegendLabelGenerator

setLegendLabelToolTipGenerator

public void setLegendLabelToolTipGenerator(PieSectionLabelGenerator generator)
Sets the legend label tool tip generator and sends a PlotChangeEvent to all registered listeners.

Parameters: generator the generator (null permitted).

See Also: getLegendLabelToolTipGenerator

setLegendLabelURLGenerator

public void setLegendLabelURLGenerator(PieURLGenerator generator)
Sets the legend label URL generator and sends a PlotChangeEvent to all registered listeners.

Parameters: generator the generator (null permitted).

Since: 1.0.4

See Also:

setMaximumLabelWidth

public void setMaximumLabelWidth(double width)
Sets the maximum label width as a percentage of the plot width and sends a PlotChangeEvent to all registered listeners.

Parameters: width the width (a percentage, where 0.20 = 20 percent).

See Also: getMaximumLabelWidth

setMinimumArcAngleToDraw

public void setMinimumArcAngleToDraw(double angle)
Sets the minimum arc angle that will be drawn. Pie sections for an angle smaller than this are not drawn, to avoid a JDK bug. See this link for details:

http://www.jfree.org/phpBB2/viewtopic.php?t=2707

...and this bug report in the Java Bug Parade:

http://developer.java.sun.com/developer/bugParade/bugs/4836495.html

Parameters: angle the minimum angle.

See Also: getMinimumArcAngleToDraw

setPieIndex

public void setPieIndex(int index)
Sets the pie index (this is used by the MultiplePiePlot class to track subplots).

Parameters: index the index.

See Also: getPieIndex

setSectionOutlinePaint

public void setSectionOutlinePaint(Paint paint)

Deprecated: Use PiePlot and setBaseSectionOutlinePaint. Deprecated as of version 1.0.6.

Sets the outline paint for ALL sections in the plot. If this is set to null, then a list of paints is used instead (to allow different colors to be used for each section).

Parameters: paint the paint (null permitted).

See Also:

setSectionOutlinePaint

public void setSectionOutlinePaint(Comparable key, Paint paint)
Sets the outline paint associated with the specified key, and sends a PlotChangeEvent to all registered listeners.

Parameters: key the key (null not permitted). paint the paint.

Throws: IllegalArgumentException if key is null.

Since: 1.0.3

See Also:

setSectionOutlinePaint

public void setSectionOutlinePaint(int section, Paint paint)

Deprecated: Use PiePlot instead.

Sets the paint used to fill a section of the pie and sends a PlotChangeEvent to all registered listeners.

Parameters: section the section index (zero-based). paint the paint (null permitted).

setSectionOutlinesVisible

public void setSectionOutlinesVisible(boolean visible)
Sets the flag that controls whether or not the outline is drawn for each pie section, and sends a PlotChangeEvent to all registered listeners.

Parameters: visible the flag.

See Also: getSectionOutlinesVisible

setSectionOutlineStroke

public void setSectionOutlineStroke(Stroke stroke)

Deprecated: Use PiePlot and setBaseSectionOutlineStroke. Deprecated as of version 1.0.6.

Sets the outline stroke for ALL sections in the plot. If this is set to null, then a list of paints is used instead (to allow different colors to be used for each section).

Parameters: stroke the stroke (null permitted).

See Also:

setSectionOutlineStroke

public void setSectionOutlineStroke(Comparable key, Stroke stroke)
Sets the outline stroke associated with the specified key, and sends a PlotChangeEvent to all registered listeners.

Parameters: key the key (null not permitted). stroke the stroke.

Throws: IllegalArgumentException if key is null.

Since: 1.0.3

See Also:

setSectionOutlineStroke

public void setSectionOutlineStroke(int section, Stroke stroke)

Deprecated: Use PiePlot instead.

Sets the stroke used to fill a section of the pie and sends a PlotChangeEvent to all registered listeners.

Parameters: section the section index (zero-based). stroke the stroke (null permitted).

setSectionPaint

public void setSectionPaint(Paint paint)

Deprecated: Use PiePlot and setBaseSectionPaint. Deprecated as of version 1.0.6.

Sets the paint for ALL sections in the plot. If this is set to null, then a list of paints is used instead (to allow different colors to be used for each section).

Parameters: paint the paint (null permitted).

See Also:

setSectionPaint

public void setSectionPaint(Comparable key, Paint paint)
Sets the paint associated with the specified key, and sends a PlotChangeEvent to all registered listeners.

Parameters: key the key (null not permitted). paint the paint.

Throws: IllegalArgumentException if key is null.

Since: 1.0.3

See Also:

setSectionPaint

public void setSectionPaint(int section, Paint paint)

Deprecated: Use PiePlot instead.

Sets the paint used to fill a section of the pie and sends a PlotChangeEvent to all registered listeners.

Parameters: section the section index (zero-based). paint the paint (null permitted).

setShadowPaint

public void setShadowPaint(Paint paint)
Sets the shadow paint and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null permitted).

See Also: getShadowPaint

setShadowXOffset

public void setShadowXOffset(double offset)
Sets the x-offset for the shadow effect and sends a PlotChangeEvent to all registered listeners.

Parameters: offset the offset (in Java2D units).

See Also: getShadowXOffset

setShadowYOffset

public void setShadowYOffset(double offset)
Sets the y-offset for the shadow effect and sends a PlotChangeEvent to all registered listeners.

Parameters: offset the offset (in Java2D units).

See Also: getShadowYOffset

setSimpleLabelOffset

public void setSimpleLabelOffset(RectangleInsets offset)
Sets the offset for the simple labels and sends a PlotChangeEvent to all registered listeners.

Parameters: offset the offset (null not permitted).

Since: 1.0.7

See Also: getSimpleLabelOffset

setSimpleLabels

public void setSimpleLabels(boolean simple)
Sets the flag that controls whether simple or extended labels are displayed on the plot, and sends a PlotChangeEvent to all registered listeners.

Parameters: simple the new flag value.

Since: 1.0.7

setStartAngle

public void setStartAngle(double angle)
Sets the starting angle and sends a PlotChangeEvent to all registered listeners. The initial default value is 90 degrees, which corresponds to 12 o'clock. A value of zero corresponds to 3 o'clock... this is the encoding used by Java's Arc2D class.

Parameters: angle the angle (in degrees).

See Also: getStartAngle

setToolTipGenerator

public void setToolTipGenerator(PieToolTipGenerator generator)
Sets the tool tip generator and sends a PlotChangeEvent to all registered listeners. Set the generator to null if you don't want any tool tips.

Parameters: generator the generator (null permitted).

See Also: getToolTipGenerator

setURLGenerator

public void setURLGenerator(PieURLGenerator generator)
Sets the URL generator and sends a PlotChangeEvent to all registered listeners.

Parameters: generator the generator (null permitted).

See Also: getURLGenerator