Package org.jfree.chart.plot
Class PiePlot
java.lang.Object
org.jfree.chart.plot.Plot
org.jfree.chart.plot.PiePlot
- All Implemented Interfaces:
Serializable
,Cloneable
,EventListener
,AnnotationChangeListener
,AxisChangeListener
,MarkerChangeListener
,LegendItemSource
,DatasetChangeListener
,org.jfree.util.PublicCloneable
A plot that displays data in the form of a pie chart, using data from any
class that implements the
PieDataset
interface.
The example shown here is generated by the PieChartDemo2.java
program included in the JFreeChart Demo Collection:

Special notes:
- the default starting point is 12 o'clock and the pie sections proceed in a clockwise direction, but these settings can be changed;
- negative values in the dataset are ignored;
- there are utility methods for creating a
PieDataset
from aCategoryDataset
;
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate boolean
A flag that controls whether or not the section outline paint is auto-populated from the drawing supplier.private boolean
A flag that controls whether or not the section outline stroke is auto-populated from the drawing supplier.private boolean
A flag that controls whether or not the section paint is auto-populated from the drawing supplier.private Paint
The base section outline paint (fallback).private Stroke
The base section outline stroke (fallback).private Paint
The base section paint (fallback).private boolean
Flag determining whether to draw an ellipse or a perfect circle.private PieDataset
The dataset for the pie chart.(package private) static final boolean
This debug flag controls whether or not an outline is drawn showing the interior of the plot region.(package private) static final boolean
This debug flag controls whether or not an outline is drawn showing the link area (in blue) and link ellipse (in yellow).(package private) static final boolean
This debug flag controls whether or not an outline is drawn showing the pie area (in green).static final double
The default interior gap.static final Paint
The default section label background paint.static final Font
The default section label font.static final Paint
The default section label outline paint.static final Stroke
The default section label outline stroke.static final Paint
The default section label paint.static final Paint
The default section label shadow paint.static final double
The default minimum arc angle to draw.static final double
The default starting angle for the pie chart.private org.jfree.util.Rotation
The direction for the pie segments.private Map
The percentage amount to explode each pie section.private boolean
A flag that controls whethernull
values are ignored.private boolean
A flag that controls whether zero values are ignored.private double
The amount of space left around the outside of the pie plot, expressed as a percentage of the plot area width and height.private Paint
The color used to draw the background of the section labels.private AbstractPieLabelDistributor
The pie section label distributor.private Font
The font used to display the section labels.private double
The gap between the labels and the link corner, as a percentage of the plot width.private PieSectionLabelGenerator
The section label generator.private double
The link margin.private Paint
The paint used for the label linking lines.private Stroke
The stroke used for the label linking lines.private PieLabelLinkStyle
The label link style.private boolean
A flag that controls whether or not the label links are drawn.private Paint
The paint used to draw the outline of the section labels (null
permitted).private Stroke
The stroke used to draw the outline of the section labels (null
permitted).private org.jfree.ui.RectangleInsets
The padding between the labels and the label outlines.private Paint
The color used to draw the section labels.private Paint
The paint used to draw the shadow for the section labels (null
permitted).private Shape
The legend item shape.private PieSectionLabelGenerator
The legend label generator.private PieSectionLabelGenerator
A tool tip generator for the legend.private PieURLGenerator
A URL generator for the legend items (optional).protected static ResourceBundle
The resourceBundle for the localization.static final double
The maximum interior gap (currently 40%).private double
The maximum label width as a percentage of the plot width.private double
The smallest arc angle that will get drawn (this is to avoid a bug in various Java implementations that causes the JVM to crash).private int
The pie index (used by theMultiplePiePlot
class).private Paint
Deprecated.This field is redundant, it is sufficient to use sectionOutlinePaintMap and baseSectionOutlinePaint.private PaintMap
The section outline paint map.private Stroke
Deprecated.This field is redundant, it is sufficient to use sectionOutlineStrokeMap and baseSectionOutlineStroke.private StrokeMap
The section outline stroke map.private boolean
A flag that controls whether or not an outline is drawn for each section in the plot.private Paint
Deprecated.This field is redundant, it is sufficient to use sectionPaintMap and baseSectionPaint.private PaintMap
The section paint map.private static final long
For serialization.private ShadowGenerator
The shadow generator for the plot (null
permitted).private Paint
The shadow paint.private double
The x-offset for the shadow effect.private double
The y-offset for the shadow effect.private org.jfree.ui.RectangleInsets
The simple label offset.private boolean
A flag that controls whether simple or extended labels are used.private double
The starting angle.private PieToolTipGenerator
The tooltip generator.private PieURLGenerator
The URL generator.Fields inherited from class org.jfree.chart.plot.Plot
DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_LEGEND_ITEM_BOX, DEFAULT_LEGEND_ITEM_CIRCLE, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO
-
Constructor Summary
ConstructorsConstructorDescriptionPiePlot()
Creates a new plot.PiePlot
(PieDataset dataset) Creates a plot that will draw a pie chart for the specified dataset. -
Method Summary
Modifier and TypeMethodDescriptionvoid
clearSectionOutlinePaints
(boolean notify) Clears the section outline paint settings for this plot and, if requested, sends aPlotChangeEvent
to all registered listeners.void
clearSectionOutlineStrokes
(boolean notify) Clears the section outline stroke settings for this plot and, if requested, sends aPlotChangeEvent
to all registered listeners.void
clearSectionPaints
(boolean notify) Clears the section paint settings for this plot and, if requested, sends aPlotChangeEvent
to all registered listeners.clone()
Returns a clone of the plot.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).protected void
drawItem
(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass) Draws a single data item.protected void
drawLabels
(Graphics2D g2, List keys, double totalValue, Rectangle2D plotArea, Rectangle2D linkArea, PiePlotState state) Draws the labels for the pie sections.protected void
drawLeftLabel
(Graphics2D g2, PiePlotState state, PieLabelRecord record) Draws a section label on the left side of the pie chart.protected void
drawLeftLabels
(KeyedValues leftKeys, Graphics2D g2, Rectangle2D plotArea, Rectangle2D linkArea, float maxLabelWidth, PiePlotState state) Draws the left labels.protected void
drawPie
(Graphics2D g2, Rectangle2D plotArea, PlotRenderingInfo info) Draws the pie.protected void
drawRightLabel
(Graphics2D g2, PiePlotState state, PieLabelRecord record) Draws a section label on the right side of the pie chart.protected void
drawRightLabels
(KeyedValues keys, Graphics2D g2, Rectangle2D plotArea, Rectangle2D linkArea, float maxLabelWidth, PiePlotState state) Draws the right labels.protected void
drawSimpleLabels
(Graphics2D g2, List keys, double totalValue, Rectangle2D plotArea, Rectangle2D pieArea, PiePlotState state) Draws the pie section labels in the simple form.boolean
Tests this plot for equality with an arbitrary object.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').protected Point2D
getArcCenter
(PiePlotState state, Comparable key) Returns the center for the specified section.boolean
Returns the flag that controls whether or not the section outline paint is auto-populated by thelookupSectionOutlinePaint(Comparable)
method.boolean
Returns the flag that controls whether or not the section outline stroke is auto-populated by thelookupSectionOutlinePaint(Comparable)
method.boolean
Returns the flag that controls whether or not the section paint is auto-populated by thelookupSectionPaint(Comparable)
method.Returns the base section paint.Returns the base section stroke.Returns the base section paint.Returns the dataset.org.jfree.util.Rotation
Returns the direction in which the pie sections are drawn (clockwise or anti-clockwise).double
getExplodePercent
(int section) Deprecated.UsegetExplodePercent(Comparable)
instead.double
Returns the amount that the section with the specified key should be exploded.boolean
Returns the flag that controls whethernull
values in the dataset are ignored.boolean
Returns the flag that controls whether zero values in the dataset are ignored.double
Returns the interior gap, measured as a percentage of the available drawing space.Returns the section label background paint.Returns the object responsible for the vertical layout of the pie section labels.Returns the section label font.double
Returns the gap between the edge of the pie and the labels, expressed as a percentage of the plot width.Returns the section label generator.protected double
Returns the distance that the end of the label link is embedded into the plot, expressed as a percentage of the plot's radius.double
Returns the margin (expressed as a percentage of the width or height) between the edge of the pie and the link point.Returns the paint used for the lines that connect pie sections to their corresponding labels.Returns the stroke used for the label linking lines.Returns the label link style.boolean
Returns the flag that controls whether or not label linking lines are visible.Returns the section label outline paint.Returns the section label outline stroke.org.jfree.ui.RectangleInsets
Returns the label padding.Returns the section label paint.Returns the section label shadow paint.Returns a collection of legend items for the pie chart.Returns the shape used for legend items.Returns the legend label generator.Returns the legend label tool tip generator.Returns the legend label URL generator.double
Returns the maximum explode percent.double
Returns the maximum label width as a percentage of the plot width.double
Returns the minimum arc angle that will be drawn.int
Returns the pie index (this is used by theMultiplePiePlot
class to track subplots).Returns a short string describing the type of plot.protected Comparable
getSectionKey
(int section) Returns a key for the specified section.Deprecated.getSectionOutlinePaint
(int section) Deprecated.UsegetSectionOutlinePaint(Comparable)
instead.Returns the outline paint associated with the specified key, ornull
if there is no paint associated with the key.Deprecated.getSectionOutlineStroke
(int section) Deprecated.UsegetSectionOutlineStroke(Comparable)
instead.Returns the outline stroke associated with the specified key, ornull
if there is no stroke associated with the key.boolean
Returns the flag that controls whether or not the outline is drawn for each pie section.Deprecated.getSectionPaint
(int section) Deprecated.UsegetSectionPaint(Comparable)
instead.Returns the paint associated with the specified key, ornull
if there is no paint associated with the key.Returns the shadow generator for the plot, if any.Returns the shadow paint.double
Returns the x-offset for the shadow effect.double
Returns the y-offset for the shadow effect.org.jfree.ui.RectangleInsets
Returns the offset used for the simple labels, if they are displayed.boolean
Returns the flag that controls whether simple or extended labels are displayed on the plot.double
Returns the start angle for the first pie section.Returns the tool tip generator, an object that is responsible for generating the text items used for tool tips by the plot.Returns the URL generator.void
handleMouseWheelRotation
(int rotateClicks) Handles a mouse wheel rotation (this method is intended for use by theMouseWheelHandler
class).initialise
(Graphics2D g2, Rectangle2D plotArea, PiePlot plot, Integer index, PlotRenderingInfo info) Initialises the drawing procedure.boolean
Returns a flag indicating whether the pie chart is circular, or stretched into an elliptical shape.protected Paint
Returns the outline paint for the specified section.protected Paint
lookupSectionOutlinePaint
(Comparable key, boolean autoPopulate) Returns the outline paint for the specified section.protected Stroke
Returns the outline stroke for the specified section.protected Stroke
lookupSectionOutlineStroke
(Comparable key, boolean autoPopulate) Returns the outline stroke for the specified section.protected Paint
Returns the paint for the specified section.protected Paint
lookupSectionPaint
(Comparable key, boolean autoPopulate) Returns the paint for the specified section.protected Paint
lookupSectionPaint
(Comparable key, PiePlotState state) Returns the paint for the specified section.private void
readObject
(ObjectInputStream stream) Provides serialization support.void
setAutoPopulateSectionOutlinePaint
(boolean auto) Sets the flag that controls whether or not the section outline paint is auto-populated by thelookupSectionOutlinePaint(Comparable)
method, and sends aPlotChangeEvent
to all registered listeners.void
setAutoPopulateSectionOutlineStroke
(boolean auto) Sets the flag that controls whether or not the section outline stroke is auto-populated by thelookupSectionOutlineStroke(Comparable)
method, and sends aPlotChangeEvent
to all registered listeners.void
setAutoPopulateSectionPaint
(boolean auto) Sets the flag that controls whether or not the section paint is auto-populated by thelookupSectionPaint(Comparable)
method, and sends aPlotChangeEvent
to all registered listeners.void
setBaseSectionOutlinePaint
(Paint paint) Sets the base section paint.void
setBaseSectionOutlineStroke
(Stroke stroke) Sets the base section stroke.void
setBaseSectionPaint
(Paint paint) Sets the base section paint and sends aPlotChangeEvent
to all registered listeners.void
setCircular
(boolean flag) A flag indicating whether the pie chart is circular, or stretched into an elliptical shape.void
setCircular
(boolean circular, boolean notify) Sets the circular attribute and, if requested, sends aPlotChangeEvent
to all registered listeners.void
setDataset
(PieDataset dataset) Sets the dataset and sends aDatasetChangeEvent
to 'this'.void
setDirection
(org.jfree.util.Rotation direction) Sets the direction in which the pie sections are drawn and sends aPlotChangeEvent
to all registered listeners.void
setExplodePercent
(int section, double percent) Deprecated.UsesetExplodePercent(Comparable, double)
instead.void
setExplodePercent
(Comparable key, double percent) Sets the amount that a pie section should be exploded and sends aPlotChangeEvent
to all registered listeners.void
setIgnoreNullValues
(boolean flag) Sets a flag that controls whethernull
values are ignored, and sends aPlotChangeEvent
to all registered listeners.void
setIgnoreZeroValues
(boolean flag) Sets a flag that controls whether zero values are ignored, and sends aPlotChangeEvent
to all registered listeners.void
setInteriorGap
(double percent) Sets the interior gap and sends aPlotChangeEvent
to all registered listeners.void
setLabelBackgroundPaint
(Paint paint) Sets the section label background paint and sends aPlotChangeEvent
to all registered listeners.void
setLabelDistributor
(AbstractPieLabelDistributor distributor) Sets the label distributor and sends aPlotChangeEvent
to all registered listeners.void
setLabelFont
(Font font) Sets the section label font and sends aPlotChangeEvent
to all registered listeners.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 aPlotChangeEvent
to all registered listeners.void
setLabelGenerator
(PieSectionLabelGenerator generator) Sets the section label generator and sends aPlotChangeEvent
to all registered listeners.void
setLabelLinkMargin
(double margin) Sets the link margin and sends aPlotChangeEvent
to all registered listeners.void
setLabelLinkPaint
(Paint paint) Sets the paint used for the lines that connect pie sections to their corresponding labels, and sends aPlotChangeEvent
to all registered listeners.void
setLabelLinkStroke
(Stroke stroke) Sets the link stroke and sends aPlotChangeEvent
to all registered listeners.void
Sets the label link style and sends aPlotChangeEvent
to all registered listeners.void
setLabelLinksVisible
(boolean visible) Sets the flag that controls whether or not label linking lines are visible and sends aPlotChangeEvent
to all registered listeners.void
setLabelOutlinePaint
(Paint paint) Sets the section label outline paint and sends aPlotChangeEvent
to all registered listeners.void
setLabelOutlineStroke
(Stroke stroke) Sets the section label outline stroke and sends aPlotChangeEvent
to all registered listeners.void
setLabelPadding
(org.jfree.ui.RectangleInsets padding) Sets the padding between each label and its outline and sends aPlotChangeEvent
to all registered listeners.void
setLabelPaint
(Paint paint) Sets the section label paint and sends aPlotChangeEvent
to all registered listeners.void
setLabelShadowPaint
(Paint paint) Sets the section label shadow paint and sends aPlotChangeEvent
to all registered listeners.void
setLegendItemShape
(Shape shape) Sets the shape used for legend items and sends aPlotChangeEvent
to all registered listeners.void
setLegendLabelGenerator
(PieSectionLabelGenerator generator) Sets the legend label generator and sends aPlotChangeEvent
to all registered listeners.void
Sets the legend label tool tip generator and sends aPlotChangeEvent
to all registered listeners.void
setLegendLabelURLGenerator
(PieURLGenerator generator) Sets the legend label URL generator and sends aPlotChangeEvent
to all registered listeners.void
setMaximumLabelWidth
(double width) Sets the maximum label width as a percentage of the plot width and sends aPlotChangeEvent
to all registered listeners.void
setMinimumArcAngleToDraw
(double angle) Sets the minimum arc angle that will be drawn.void
setPieIndex
(int index) Sets the pie index (this is used by theMultiplePiePlot
class to track subplots).void
setSectionOutlinePaint
(int section, Paint paint) Deprecated.UsesetSectionOutlinePaint(Comparable, Paint)
instead.void
setSectionOutlinePaint
(Paint paint) Deprecated.void
setSectionOutlinePaint
(Comparable key, Paint paint) Sets the outline paint associated with the specified key, and sends aPlotChangeEvent
to all registered listeners.void
setSectionOutlineStroke
(int section, Stroke stroke) Deprecated.UsesetSectionOutlineStroke(Comparable, Stroke)
instead.void
setSectionOutlineStroke
(Stroke stroke) Deprecated.void
setSectionOutlineStroke
(Comparable key, Stroke stroke) Sets the outline stroke associated with the specified key, and sends aPlotChangeEvent
to all registered listeners.void
setSectionOutlinesVisible
(boolean visible) Sets the flag that controls whether or not the outline is drawn for each pie section, and sends aPlotChangeEvent
to all registered listeners.void
setSectionPaint
(int section, Paint paint) Deprecated.UsesetSectionPaint(Comparable, Paint)
instead.void
setSectionPaint
(Paint paint) Deprecated.void
setSectionPaint
(Comparable key, Paint paint) Sets the paint associated with the specified key, and sends aPlotChangeEvent
to all registered listeners.void
setShadowGenerator
(ShadowGenerator generator) Sets the shadow generator for the plot and sends aPlotChangeEvent
to all registered listeners.void
setShadowPaint
(Paint paint) Sets the shadow paint and sends aPlotChangeEvent
to all registered listeners.void
setShadowXOffset
(double offset) Sets the x-offset for the shadow effect and sends aPlotChangeEvent
to all registered listeners.void
setShadowYOffset
(double offset) Sets the y-offset for the shadow effect and sends aPlotChangeEvent
to all registered listeners.void
setSimpleLabelOffset
(org.jfree.ui.RectangleInsets offset) Sets the offset for the simple labels and sends aPlotChangeEvent
to all registered listeners.void
setSimpleLabels
(boolean simple) Sets the flag that controls whether simple or extended labels are displayed on the plot, and sends aPlotChangeEvent
to all registered listeners.void
setStartAngle
(double angle) Sets the starting angle and sends aPlotChangeEvent
to all registered listeners.void
setToolTipGenerator
(PieToolTipGenerator generator) Sets the tool tip generator and sends aPlotChangeEvent
to all registered listeners.void
setURLGenerator
(PieURLGenerator generator) Sets the URL generator and sends aPlotChangeEvent
to all registered listeners.private void
writeObject
(ObjectOutputStream stream) Provides serialization support.Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, annotationChanged, axisChanged, createAndAddEntity, datasetChanged, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fillBackground, fillBackground, fireChangeEvent, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, handleClick, isNotify, isOutlineVisible, isSubplot, markerChanged, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setDatasetGroup, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setNotify, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParent, zoom
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDFor serialization.- See Also:
-
DEFAULT_INTERIOR_GAP
public static final double DEFAULT_INTERIOR_GAPThe default interior gap.- See Also:
-
MAX_INTERIOR_GAP
public static final double MAX_INTERIOR_GAPThe maximum interior gap (currently 40%).- See Also:
-
DEFAULT_START_ANGLE
public static final double DEFAULT_START_ANGLEThe default starting angle for the pie chart.- See Also:
-
DEFAULT_LABEL_FONT
The default section label font. -
DEFAULT_LABEL_PAINT
The default section label paint. -
DEFAULT_LABEL_BACKGROUND_PAINT
The default section label background paint. -
DEFAULT_LABEL_OUTLINE_PAINT
The default section label outline paint. -
DEFAULT_LABEL_OUTLINE_STROKE
The default section label outline stroke. -
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_DRAWThe default minimum arc angle to draw.- See Also:
-
dataset
The dataset for the pie chart. -
pieIndex
private int pieIndexThe pie index (used by theMultiplePiePlot
class). -
interiorGap
private double interiorGapThe amount of space left around the outside of the pie plot, expressed as a percentage of the plot area width and height. -
circular
private boolean circularFlag determining whether to draw an ellipse or a perfect circle. -
startAngle
private double startAngleThe starting angle. -
direction
private org.jfree.util.Rotation directionThe direction for the pie segments. -
sectionPaintMap
The section paint map. -
baseSectionPaint
The base section paint (fallback). -
autoPopulateSectionPaint
private boolean autoPopulateSectionPaintA flag that controls whether or not the section paint is auto-populated from the drawing supplier.- Since:
- 1.0.11
-
sectionOutlinesVisible
private boolean sectionOutlinesVisibleA flag that controls whether or not an outline is drawn for each section in the plot. -
sectionOutlinePaintMap
The section outline paint map. -
baseSectionOutlinePaint
The base section outline paint (fallback). -
autoPopulateSectionOutlinePaint
private boolean autoPopulateSectionOutlinePaintA flag that controls whether or not the section outline paint is auto-populated from the drawing supplier.- Since:
- 1.0.11
-
sectionOutlineStrokeMap
The section outline stroke map. -
baseSectionOutlineStroke
The base section outline stroke (fallback). -
autoPopulateSectionOutlineStroke
private boolean autoPopulateSectionOutlineStrokeA flag that controls whether or not the section outline stroke is auto-populated from the drawing supplier.- Since:
- 1.0.11
-
shadowPaint
The shadow paint. -
shadowXOffset
private double shadowXOffsetThe x-offset for the shadow effect. -
shadowYOffset
private double shadowYOffsetThe y-offset for the shadow effect. -
explodePercentages
The percentage amount to explode each pie section. -
labelGenerator
The section label generator. -
labelFont
The font used to display the section labels. -
labelPaint
The color used to draw the section labels. -
labelBackgroundPaint
The color used to draw the background of the section labels. If this isnull
, the background is not filled. -
labelOutlinePaint
The paint used to draw the outline of the section labels (null
permitted). -
labelOutlineStroke
The stroke used to draw the outline of the section labels (null
permitted). -
labelShadowPaint
The paint used to draw the shadow for the section labels (null
permitted). -
simpleLabels
private boolean simpleLabelsA flag that controls whether simple or extended labels are used.- Since:
- 1.0.7
-
labelPadding
private org.jfree.ui.RectangleInsets labelPaddingThe padding between the labels and the label outlines. This is not allowed to benull
.- Since:
- 1.0.7
-
simpleLabelOffset
private org.jfree.ui.RectangleInsets simpleLabelOffsetThe simple label offset.- Since:
- 1.0.7
-
maximumLabelWidth
private double maximumLabelWidthThe maximum label width as a percentage of the plot width. -
labelGap
private double labelGapThe gap between the labels and the link corner, as a percentage of the plot width. -
labelLinksVisible
private boolean labelLinksVisibleA flag that controls whether or not the label links are drawn. -
labelLinkStyle
The label link style.- Since:
- 1.0.10
-
labelLinkMargin
private double labelLinkMarginThe link margin. -
labelLinkPaint
The paint used for the label linking lines. -
labelLinkStroke
The stroke used for the label linking lines. -
labelDistributor
The pie section label distributor.- Since:
- 1.0.6
-
toolTipGenerator
The tooltip generator. -
urlGenerator
The URL generator. -
legendLabelGenerator
The legend label generator. -
legendLabelToolTipGenerator
A tool tip generator for the legend. -
legendLabelURLGenerator
A URL generator for the legend items (optional).- Since:
- 1.0.4.
-
ignoreNullValues
private boolean ignoreNullValuesA flag that controls whethernull
values are ignored. -
ignoreZeroValues
private boolean ignoreZeroValuesA flag that controls whether zero values are ignored. -
legendItemShape
The legend item shape. -
minimumArcAngleToDraw
private double minimumArcAngleToDrawThe smallest arc angle that will get drawn (this is to avoid a bug in various Java implementations that causes the JVM to crash). 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 -
shadowGenerator
The shadow generator for the plot (null
permitted).- Since:
- 1.0.14
-
localizationResources
The resourceBundle for the localization. -
DEBUG_DRAW_INTERIOR
static final boolean DEBUG_DRAW_INTERIORThis debug flag controls whether or not an outline is drawn showing the interior of the plot region. This is drawn as a lightGray rectangle showing the padding provided by the 'interiorGap' setting.- See Also:
-
DEBUG_DRAW_LINK_AREA
static final boolean DEBUG_DRAW_LINK_AREAThis debug flag controls whether or not an outline is drawn showing the link area (in blue) and link ellipse (in yellow). This controls where the label links have 'elbow' points.- See Also:
-
DEBUG_DRAW_PIE_AREA
static final boolean DEBUG_DRAW_PIE_AREAThis debug flag controls whether or not an outline is drawn showing the pie area (in green).- See Also:
-
sectionPaint
Deprecated.This field is redundant, it is sufficient to use sectionPaintMap and baseSectionPaint. Deprecated as of version 1.0.6.The paint for ALL sections (overrides list). -
sectionOutlinePaint
Deprecated.This field is redundant, it is sufficient to use sectionOutlinePaintMap and baseSectionOutlinePaint. Deprecated as of version 1.0.6.The outline paint for ALL sections (overrides list). -
sectionOutlineStroke
Deprecated.This field is redundant, it is sufficient to use sectionOutlineStrokeMap and baseSectionOutlineStroke. Deprecated as of version 1.0.6.The outline stroke for ALL sections (overrides list).
-
-
Constructor Details
-
PiePlot
public PiePlot()Creates a new plot. The dataset is initially set tonull
. -
PiePlot
Creates a plot that will draw a pie chart for the specified dataset.- Parameters:
dataset
- the dataset (null
permitted).
-
-
Method Details
-
getDataset
Returns the dataset.- Returns:
- The dataset (possibly
null
). - See Also:
-
setDataset
Sets the dataset and sends aDatasetChangeEvent
to 'this'.- Parameters:
dataset
- the dataset (null
permitted).- See Also:
-
getPieIndex
public int getPieIndex()Returns the pie index (this is used by theMultiplePiePlot
class to track subplots).- Returns:
- The pie index.
- See Also:
-
setPieIndex
public void setPieIndex(int index) Sets the pie index (this is used by theMultiplePiePlot
class to track subplots).- Parameters:
index
- the index.- See Also:
-
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:
-
setStartAngle
public void setStartAngle(double angle) Sets the starting angle and sends aPlotChangeEvent
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:
-
getDirection
public org.jfree.util.Rotation getDirection()Returns the direction in which the pie sections are drawn (clockwise or anti-clockwise).- Returns:
- The direction (never
null
). - See Also:
-
setDirection
public void setDirection(org.jfree.util.Rotation direction) Sets the direction in which the pie sections are drawn and sends aPlotChangeEvent
to all registered listeners.- Parameters:
direction
- the direction (null
not permitted).- See Also:
-
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:
-
setInteriorGap
public void setInteriorGap(double percent) Sets the interior gap and sends aPlotChangeEvent
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:
-
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:
-
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:
-
setCircular
public void setCircular(boolean circular, boolean notify) Sets the circular attribute and, if requested, sends aPlotChangeEvent
to all registered listeners.- Parameters:
circular
- the new value of the flag.notify
- notify listeners?- See Also:
-
getIgnoreNullValues
public boolean getIgnoreNullValues()Returns the flag that controls whethernull
values in the dataset are ignored.- Returns:
- A boolean.
- See Also:
-
setIgnoreNullValues
public void setIgnoreNullValues(boolean flag) Sets a flag that controls whethernull
values are ignored, and sends aPlotChangeEvent
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:
-
getIgnoreZeroValues
public boolean getIgnoreZeroValues()Returns the flag that controls whether zero values in the dataset are ignored.- Returns:
- A boolean.
- See Also:
-
setIgnoreZeroValues
public void setIgnoreZeroValues(boolean flag) Sets a flag that controls whether zero values are ignored, and sends aPlotChangeEvent
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:
-
lookupSectionPaint
Returns the paint for the specified section. This is equivalent tolookupSectionPaint(section, getAutoPopulateSectionPaint())
.- Parameters:
key
- the section key.- Returns:
- The paint for the specified section.
- Since:
- 1.0.3
- See Also:
-
lookupSectionPaint
Returns the paint for the specified section. The lookup involves these steps:- if
getSectionPaint()
is non-null
, return it; - if
getSectionPaint(int)
is non-null
return it; - if
getSectionPaint(int)
isnull
butautoPopulate
istrue
, attempt to fetch a new paint from the drawing supplier (Plot.getDrawingSupplier()
); - if all else fails, return
getBaseSectionPaint()
.
- 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
- if
-
getSectionPaint
Deprecated.UsegetSectionPaint(Comparable)
andgetBaseSectionPaint()
. Deprecated as of version 1.0.6.Returns the paint for ALL sections in the plot.- Returns:
- The paint (possibly
null
). - See Also:
-
setSectionPaint
Deprecated.UsesetSectionPaint(Comparable, Paint)
andsetBaseSectionPaint(Paint)
. Deprecated as of version 1.0.6.Sets the paint for ALL sections in the plot. If this is set tonull
, 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:
-
getSectionKey
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
-
getSectionPaint
Returns the paint associated with the specified key, ornull
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
- ifkey
isnull
.- Since:
- 1.0.3
- See Also:
-
setSectionPaint
Sets the paint associated with the specified key, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
key
- the key (null
not permitted).paint
- the paint.- Throws:
IllegalArgumentException
- ifkey
isnull
.- Since:
- 1.0.3
- See Also:
-
clearSectionPaints
public void clearSectionPaints(boolean notify) Clears the section paint settings for this plot and, if requested, sends aPlotChangeEvent
to all registered listeners. Be aware that if theautoPopulateSectionPaint
flag is set, the section paints may be repopulated using the same colours as before.- Parameters:
notify
- notify listeners?- Since:
- 1.0.11
- See Also:
-
getBaseSectionPaint
Returns the base section paint. This is used when no other paint is defined, which is rare. The default value isColor.gray
.- Returns:
- The paint (never
null
). - See Also:
-
setBaseSectionPaint
Sets the base section paint and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getAutoPopulateSectionPaint
public boolean getAutoPopulateSectionPaint()Returns the flag that controls whether or not the section paint is auto-populated by thelookupSectionPaint(Comparable)
method.- Returns:
- A boolean.
- Since:
- 1.0.11
-
setAutoPopulateSectionPaint
public void setAutoPopulateSectionPaint(boolean auto) Sets the flag that controls whether or not the section paint is auto-populated by thelookupSectionPaint(Comparable)
method, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
auto
- auto-populate?- Since:
- 1.0.11
-
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:
-
setSectionOutlinesVisible
public void setSectionOutlinesVisible(boolean visible) Sets the flag that controls whether or not the outline is drawn for each pie section, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
visible
- the flag.- See Also:
-
lookupSectionOutlinePaint
Returns the outline paint for the specified section. This is equivalent tolookupSectionPaint(section, getAutoPopulateSectionOutlinePaint())
.- Parameters:
key
- the section key.- Returns:
- The paint for the specified section.
- Since:
- 1.0.3
- See Also:
-
lookupSectionOutlinePaint
Returns the outline paint for the specified section. The lookup involves these steps:- if
getSectionOutlinePaint()
is non-null
, return it; - otherwise, if
getSectionOutlinePaint(int)
is non-null
return it; - if
getSectionOutlinePaint(int)
isnull
butautoPopulate
istrue
, attempt to fetch a new outline paint from the drawing supplier (Plot.getDrawingSupplier()
); - if all else fails, return
getBaseSectionOutlinePaint()
.
- 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
- if
-
getSectionOutlinePaint
Returns the outline paint associated with the specified key, ornull
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
- ifkey
isnull
.- Since:
- 1.0.3
- See Also:
-
setSectionOutlinePaint
Sets the outline paint associated with the specified key, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
key
- the key (null
not permitted).paint
- the paint.- Throws:
IllegalArgumentException
- ifkey
isnull
.- Since:
- 1.0.3
- See Also:
-
clearSectionOutlinePaints
public void clearSectionOutlinePaints(boolean notify) Clears the section outline paint settings for this plot and, if requested, sends aPlotChangeEvent
to all registered listeners. Be aware that if theautoPopulateSectionPaint
flag is set, the section paints may be repopulated using the same colours as before.- Parameters:
notify
- notify listeners?- Since:
- 1.0.11
- See Also:
-
getBaseSectionOutlinePaint
Returns the base section paint. This is used when no other paint is available.- Returns:
- The paint (never
null
). - See Also:
-
setBaseSectionOutlinePaint
Sets the base section paint.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getAutoPopulateSectionOutlinePaint
public boolean getAutoPopulateSectionOutlinePaint()Returns the flag that controls whether or not the section outline paint is auto-populated by thelookupSectionOutlinePaint(Comparable)
method.- Returns:
- A boolean.
- Since:
- 1.0.11
-
setAutoPopulateSectionOutlinePaint
public void setAutoPopulateSectionOutlinePaint(boolean auto) Sets the flag that controls whether or not the section outline paint is auto-populated by thelookupSectionOutlinePaint(Comparable)
method, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
auto
- auto-populate?- Since:
- 1.0.11
-
lookupSectionOutlineStroke
Returns the outline stroke for the specified section. This is equivalent tolookupSectionOutlineStroke(section, getAutoPopulateSectionOutlineStroke())
.- Parameters:
key
- the section key.- Returns:
- The stroke for the specified section.
- Since:
- 1.0.3
- See Also:
-
lookupSectionOutlineStroke
Returns the outline stroke for the specified section. The lookup involves these steps:- if
getSectionOutlineStroke()
is non-null
, return it; - otherwise, if
getSectionOutlineStroke(int)
is non-null
return it; - if
getSectionOutlineStroke(int)
isnull
butautoPopulate
istrue
, attempt to fetch a new outline stroke from the drawing supplier (Plot.getDrawingSupplier()
); - if all else fails, return
getBaseSectionOutlineStroke()
.
- 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
- if
-
getSectionOutlineStroke
Returns the outline stroke associated with the specified key, ornull
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
- ifkey
isnull
.- Since:
- 1.0.3
- See Also:
-
setSectionOutlineStroke
Sets the outline stroke associated with the specified key, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
key
- the key (null
not permitted).stroke
- the stroke.- Throws:
IllegalArgumentException
- ifkey
isnull
.- Since:
- 1.0.3
- See Also:
-
clearSectionOutlineStrokes
public void clearSectionOutlineStrokes(boolean notify) Clears the section outline stroke settings for this plot and, if requested, sends aPlotChangeEvent
to all registered listeners. Be aware that if theautoPopulateSectionPaint
flag is set, the section paints may be repopulated using the same colours as before.- Parameters:
notify
- notify listeners?- Since:
- 1.0.11
- See Also:
-
getBaseSectionOutlineStroke
Returns the base section stroke. This is used when no other stroke is available.- Returns:
- The stroke (never
null
). - See Also:
-
setBaseSectionOutlineStroke
Sets the base section stroke.- Parameters:
stroke
- the stroke (null
not permitted).- See Also:
-
getAutoPopulateSectionOutlineStroke
public boolean getAutoPopulateSectionOutlineStroke()Returns the flag that controls whether or not the section outline stroke is auto-populated by thelookupSectionOutlinePaint(Comparable)
method.- Returns:
- A boolean.
- Since:
- 1.0.11
-
setAutoPopulateSectionOutlineStroke
public void setAutoPopulateSectionOutlineStroke(boolean auto) Sets the flag that controls whether or not the section outline stroke is auto-populated by thelookupSectionOutlineStroke(Comparable)
method, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
auto
- auto-populate?- Since:
- 1.0.11
-
getShadowPaint
Returns the shadow paint.- Returns:
- The paint (possibly
null
). - See Also:
-
setShadowPaint
Sets the shadow paint and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
permitted).- See Also:
-
getShadowXOffset
public double getShadowXOffset()Returns the x-offset for the shadow effect.- Returns:
- The offset (in Java2D units).
- See Also:
-
setShadowXOffset
public void setShadowXOffset(double offset) Sets the x-offset for the shadow effect and sends aPlotChangeEvent
to all registered listeners.- Parameters:
offset
- the offset (in Java2D units).- See Also:
-
getShadowYOffset
public double getShadowYOffset()Returns the y-offset for the shadow effect.- Returns:
- The offset (in Java2D units).
- See Also:
-
setShadowYOffset
public void setShadowYOffset(double offset) Sets the y-offset for the shadow effect and sends aPlotChangeEvent
to all registered listeners.- Parameters:
offset
- the offset (in Java2D units).- See Also:
-
getExplodePercent
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
- ifkey
isnull
.- Since:
- 1.0.3
- See Also:
-
setExplodePercent
Sets the amount that a pie section should be exploded and sends aPlotChangeEvent
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:
-
getMaximumExplodePercent
public double getMaximumExplodePercent()Returns the maximum explode percent.- Returns:
- The percent.
-
getLabelGenerator
Returns the section label generator.- Returns:
- The generator (possibly
null
). - See Also:
-
setLabelGenerator
Sets the section label generator and sends aPlotChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
permitted).- See Also:
-
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:
-
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 aPlotChangeEvent
to all registered listeners.- Parameters:
gap
- the gap (a percentage, where 0.05 = five percent).- See Also:
-
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:
-
setMaximumLabelWidth
public void setMaximumLabelWidth(double width) Sets the maximum label width as a percentage of the plot width and sends aPlotChangeEvent
to all registered listeners.- Parameters:
width
- the width (a percentage, where 0.20 = 20 percent).- See Also:
-
getLabelLinksVisible
public boolean getLabelLinksVisible()Returns the flag that controls whether or not label linking lines are visible.- Returns:
- A boolean.
- See Also:
-
setLabelLinksVisible
public void setLabelLinksVisible(boolean visible) Sets the flag that controls whether or not label linking lines are visible and sends aPlotChangeEvent
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:
-
getLabelLinkStyle
Returns the label link style.- Returns:
- The label link style (never
null
). - Since:
- 1.0.10
- See Also:
-
setLabelLinkStyle
Sets the label link style and sends aPlotChangeEvent
to all registered listeners.- Parameters:
style
- the new style (null
not permitted).- Since:
- 1.0.10
- See Also:
-
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:
-
setLabelLinkMargin
public void setLabelLinkMargin(double margin) Sets the link margin and sends aPlotChangeEvent
to all registered listeners.- Parameters:
margin
- the margin.- See Also:
-
getLabelLinkPaint
Returns the paint used for the lines that connect pie sections to their corresponding labels.- Returns:
- The paint (never
null
). - See Also:
-
setLabelLinkPaint
Sets the paint used for the lines that connect pie sections to their corresponding labels, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getLabelLinkStroke
Returns the stroke used for the label linking lines.- Returns:
- The stroke.
- See Also:
-
setLabelLinkStroke
Sets the link stroke and sends aPlotChangeEvent
to all registered listeners.- Parameters:
stroke
- the stroke.- See Also:
-
getLabelLinkDepth
protected double getLabelLinkDepth()Returns the distance that the end of the label link is embedded into the plot, expressed as a percentage of the plot's radius.
This method is overridden in theRingPlot
class to resolve bug 2121818.- Returns:
0.10
.- Since:
- 1.0.12
-
getLabelFont
Returns the section label font.- Returns:
- The font (never
null
). - See Also:
-
setLabelFont
Sets the section label font and sends aPlotChangeEvent
to all registered listeners.- Parameters:
font
- the font (null
not permitted).- See Also:
-
getLabelPaint
Returns the section label paint.- Returns:
- The paint (never
null
). - See Also:
-
setLabelPaint
Sets the section label paint and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getLabelBackgroundPaint
Returns the section label background paint.- Returns:
- The paint (possibly
null
). - See Also:
-
setLabelBackgroundPaint
Sets the section label background paint and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
permitted).- See Also:
-
getLabelOutlinePaint
Returns the section label outline paint.- Returns:
- The paint (possibly
null
). - See Also:
-
setLabelOutlinePaint
Sets the section label outline paint and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
permitted).- See Also:
-
getLabelOutlineStroke
Returns the section label outline stroke.- Returns:
- The stroke (possibly
null
). - See Also:
-
setLabelOutlineStroke
Sets the section label outline stroke and sends aPlotChangeEvent
to all registered listeners.- Parameters:
stroke
- the stroke (null
permitted).- See Also:
-
getLabelShadowPaint
Returns the section label shadow paint.- Returns:
- The paint (possibly
null
). - See Also:
-
setLabelShadowPaint
Sets the section label shadow paint and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
permitted).- See Also:
-
getLabelPadding
public org.jfree.ui.RectangleInsets getLabelPadding()Returns the label padding.- Returns:
- The label padding (never
null
). - Since:
- 1.0.7
- See Also:
-
setLabelPadding
public void setLabelPadding(org.jfree.ui.RectangleInsets padding) Sets the padding between each label and its outline and sends aPlotChangeEvent
to all registered listeners.- Parameters:
padding
- the padding (null
not permitted).- Since:
- 1.0.7
- See Also:
-
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
-
setSimpleLabels
public void setSimpleLabels(boolean simple) Sets the flag that controls whether simple or extended labels are displayed on the plot, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
simple
- the new flag value.- Since:
- 1.0.7
-
getSimpleLabelOffset
public org.jfree.ui.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
public void setSimpleLabelOffset(org.jfree.ui.RectangleInsets offset) Sets the offset for the simple labels and sends aPlotChangeEvent
to all registered listeners.- Parameters:
offset
- the offset (null
not permitted).- Since:
- 1.0.7
- See Also:
-
getLabelDistributor
Returns the object responsible for the vertical layout of the pie section labels.- Returns:
- The label distributor (never
null
). - Since:
- 1.0.6
-
setLabelDistributor
Sets the label distributor and sends aPlotChangeEvent
to all registered listeners.- Parameters:
distributor
- the distributor (null
not permitted).- Since:
- 1.0.6
-
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 isnull
, no tool tips will be created.- Returns:
- The generator (possibly
null
). - See Also:
-
setToolTipGenerator
Sets the tool tip generator and sends aPlotChangeEvent
to all registered listeners. Set the generator tonull
if you don't want any tool tips.- Parameters:
generator
- the generator (null
permitted).- See Also:
-
getURLGenerator
Returns the URL generator.- Returns:
- The generator (possibly
null
). - See Also:
-
setURLGenerator
Sets the URL generator and sends aPlotChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
permitted).- See Also:
-
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:
-
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:
-
getLegendItemShape
Returns the shape used for legend items.- Returns:
- The shape (never
null
). - See Also:
-
setLegendItemShape
Sets the shape used for legend items and sends aPlotChangeEvent
to all registered listeners.- Parameters:
shape
- the shape (null
not permitted).- See Also:
-
getLegendLabelGenerator
Returns the legend label generator.- Returns:
- The legend label generator (never
null
). - See Also:
-
setLegendLabelGenerator
Sets the legend label generator and sends aPlotChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
not permitted).- See Also:
-
getLegendLabelToolTipGenerator
Returns the legend label tool tip generator.- Returns:
- The legend label tool tip generator (possibly
null
). - See Also:
-
setLegendLabelToolTipGenerator
Sets the legend label tool tip generator and sends aPlotChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
permitted).- See Also:
-
getLegendLabelURLGenerator
Returns the legend label URL generator.- Returns:
- The legend label URL generator (possibly
null
). - Since:
- 1.0.4
- See Also:
-
setLegendLabelURLGenerator
Sets the legend label URL generator and sends aPlotChangeEvent
to all registered listeners.- Parameters:
generator
- the generator (null
permitted).- Since:
- 1.0.4
- See Also:
-
getShadowGenerator
Returns the shadow generator for the plot, if any.- Returns:
- The shadow generator (possibly
null
). - Since:
- 1.0.14
-
setShadowGenerator
Sets the shadow generator for the plot and sends aPlotChangeEvent
to all registered listeners. Note that this is a bitmap drop-shadow generation facility and is separate from the vector based show option that is controlled via thesetShadowPaint(java.awt.Paint)
method.- Parameters:
generator
- the generator (null
permitted).- Since:
- 1.0.14
-
handleMouseWheelRotation
public void handleMouseWheelRotation(int rotateClicks) Handles a mouse wheel rotation (this method is intended for use by theMouseWheelHandler
class).- Parameters:
rotateClicks
- the number of rotate clicks on the the mouse wheel.- Since:
- 1.0.14
-
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).
-
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). -
drawPie
Draws the pie.- Parameters:
g2
- the graphics device.plotArea
- the plot area.info
- chart rendering info.
-
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.
-
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
-
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.
-
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.
-
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.
-
getLegendItems
Returns a collection of legend items for the pie chart.- Specified by:
getLegendItems
in interfaceLegendItemSource
- Overrides:
getLegendItems
in classPlot
- Returns:
- The legend items (never
null
).
-
getPlotType
Returns a short string describing the type of plot.- Specified by:
getPlotType
in classPlot
- Returns:
- The plot type.
-
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.
-
drawLeftLabel
Draws a section label on the left side of the pie chart.- Parameters:
g2
- the graphics device.state
- the state.record
- the label record.
-
drawRightLabel
Draws a section label on the right side of the pie chart.- Parameters:
g2
- the graphics device.state
- the state.record
- the label record.
-
getArcCenter
Returns the center for the specified section. Checks to see if the section is exploded and recalculates the new center if so.- Parameters:
state
- PiePlotStatekey
- section key.- Returns:
- The center for the specified section.
- Since:
- 1.0.14
-
lookupSectionPaint
Returns the paint for the specified section. This is equivalent tolookupSectionPaint(section)
. Checks to see if the user set the Paint to be of type RadialGradientPaint If so it adjusts the center and radius to match the Pie- Parameters:
key
- the section key.state
- PiePlotState.- Returns:
- The paint for the specified section.
- Since:
- 1.0.14
-
equals
Tests this plot for equality with an arbitrary object. Note that the plot's dataset is NOT included in the test for equality. -
clone
Returns a clone of the plot.- Specified by:
clone
in interfaceorg.jfree.util.PublicCloneable
- Overrides:
clone
in classPlot
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- if some component of the plot does not support cloning.
-
writeObject
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
IOException
- if there is an I/O error.
-
readObject
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
IOException
- if there is an I/O error.ClassNotFoundException
- if there is a classpath problem.
-
getSectionPaint
Deprecated.UsegetSectionPaint(Comparable)
instead.Returns the paint for the specified section.- Parameters:
section
- the section index (zero-based).- Returns:
- The paint (never
null
).
-
setSectionPaint
Deprecated.UsesetSectionPaint(Comparable, Paint)
instead.Sets the paint used to fill a section of the pie and sends aPlotChangeEvent
to all registered listeners.- Parameters:
section
- the section index (zero-based).paint
- the paint (null
permitted).
-
getSectionOutlinePaint
Deprecated.UsegetSectionOutlinePaint(Comparable)
andgetBaseSectionOutlinePaint()
. Deprecated as of version 1.0.6.Returns the outline paint for ALL sections in the plot.- Returns:
- The paint (possibly
null
). - See Also:
-
setSectionOutlinePaint
Deprecated.UsesetSectionOutlinePaint(Comparable, Paint)
andsetBaseSectionOutlinePaint(Paint)
. Deprecated as of version 1.0.6.Sets the outline paint for ALL sections in the plot. If this is set tonull
, 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:
-
getSectionOutlinePaint
Deprecated.UsegetSectionOutlinePaint(Comparable)
instead.Returns the paint for the specified section.- Parameters:
section
- the section index (zero-based).- Returns:
- The paint (possibly
null
).
-
setSectionOutlinePaint
Deprecated.UsesetSectionOutlinePaint(Comparable, Paint)
instead.Sets the paint used to fill a section of the pie and sends aPlotChangeEvent
to all registered listeners.- Parameters:
section
- the section index (zero-based).paint
- the paint (null
permitted).
-
getSectionOutlineStroke
Deprecated.UsegetSectionOutlineStroke(Comparable)
andgetBaseSectionOutlineStroke()
. Deprecated as of version 1.0.6.Returns the outline stroke for ALL sections in the plot.- Returns:
- The stroke (possibly
null
). - See Also:
-
setSectionOutlineStroke
Deprecated.UsesetSectionOutlineStroke(Comparable, Stroke)
andsetBaseSectionOutlineStroke(Stroke)
. Deprecated as of version 1.0.6.Sets the outline stroke for ALL sections in the plot. If this is set tonull
, 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:
-
getSectionOutlineStroke
Deprecated.UsegetSectionOutlineStroke(Comparable)
instead.Returns the stroke for the specified section.- Parameters:
section
- the section index (zero-based).- Returns:
- The stroke (possibly
null
).
-
setSectionOutlineStroke
Deprecated.UsesetSectionOutlineStroke(Comparable, Stroke)
instead.Sets the stroke used to fill a section of the pie and sends aPlotChangeEvent
to all registered listeners.- Parameters:
section
- the section index (zero-based).stroke
- the stroke (null
permitted).
-
getExplodePercent
public double getExplodePercent(int section) Deprecated.UsegetExplodePercent(Comparable)
instead.Returns the amount that a section should be 'exploded'.- Parameters:
section
- the section number.- Returns:
- The amount that a section should be 'exploded'.
-
setExplodePercent
public void setExplodePercent(int section, double percent) Deprecated.UsesetExplodePercent(Comparable, double)
instead.Sets the amount that a pie section should be exploded and sends aPlotChangeEvent
to all registered listeners.- Parameters:
section
- the section index.percent
- the explode percentage (0.30 = 30 percent).
-