public class PiePlot extends Plot implements Cloneable, Serializable
PieDataset
interface.
The example shown here is generated by the PieChartDemo2.java
program included in the JFreeChart Demo Collection:
Special notes:
PieDataset
from a
CategoryDataset
;Plot
,
PieDataset
,
Serialized FormModifier and Type | Field and Description |
---|---|
static double |
DEFAULT_INTERIOR_GAP
The default interior gap.
|
static Paint |
DEFAULT_LABEL_BACKGROUND_PAINT
The default section label background paint.
|
static Font |
DEFAULT_LABEL_FONT
The default section label font.
|
static Paint |
DEFAULT_LABEL_OUTLINE_PAINT
The default section label outline paint.
|
static Stroke |
DEFAULT_LABEL_OUTLINE_STROKE
The default section label outline stroke.
|
static Paint |
DEFAULT_LABEL_PAINT
The default section label paint.
|
static Paint |
DEFAULT_LABEL_SHADOW_PAINT
The default section label shadow paint.
|
static double |
DEFAULT_MINIMUM_ARC_ANGLE_TO_DRAW
The default minimum arc angle to draw.
|
static double |
DEFAULT_START_ANGLE
The default starting angle for the pie chart.
|
protected static ResourceBundle |
localizationResources
The resourceBundle for the localization.
|
static double |
MAX_INTERIOR_GAP
The maximum interior gap (currently 40%).
|
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 and Description |
---|
PiePlot()
Creates a new plot.
|
PiePlot(PieDataset dataset)
Creates a plot that will draw a pie chart for the specified dataset.
|
Modifier and Type | Method and Description |
---|---|
void |
clearSectionOutlinePaints(boolean notify)
Clears the section outline paint settings for this plot and, if
requested, sends a
PlotChangeEvent to all registered listeners. |
void |
clearSectionOutlineStrokes(boolean notify)
Clears the section outline stroke settings for this plot and, if
requested, sends a
PlotChangeEvent to all registered listeners. |
void |
clearSectionPaints(boolean notify)
Clears the section paint settings for this plot and, if requested, sends
a
PlotChangeEvent to all registered listeners. |
Object |
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 |
equals(Object obj)
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 |
getAutoPopulateSectionOutlinePaint()
Returns the flag that controls whether or not the section outline paint
is auto-populated by the
lookupSectionOutlinePaint(Comparable)
method. |
boolean |
getAutoPopulateSectionOutlineStroke()
Returns the flag that controls whether or not the section outline stroke
is auto-populated by the
lookupSectionOutlinePaint(Comparable)
method. |
boolean |
getAutoPopulateSectionPaint()
Returns the flag that controls whether or not the section paint is
auto-populated by the
lookupSectionPaint(Comparable) method. |
PieDataset |
getDataset()
Returns the dataset.
|
Paint |
getDefaultSectionOutlinePaint()
Returns the default section paint.
|
Stroke |
getDefaultSectionOutlineStroke()
Returns the default section stroke.
|
Paint |
getDefaultSectionPaint()
Returns the default section paint.
|
Rotation |
getDirection()
Returns the direction in which the pie sections are drawn (clockwise or
anti-clockwise).
|
double |
getExplodePercent(Comparable key)
Returns the amount that the section with the specified key should be
exploded.
|
boolean |
getIgnoreNullValues()
Returns the flag that controls whether
null values in the
dataset are ignored. |
boolean |
getIgnoreZeroValues()
Returns the flag that controls whether zero values in the
dataset are ignored.
|
double |
getInteriorGap()
Returns the interior gap, measured as a percentage of the available
drawing space.
|
Paint |
getLabelBackgroundPaint()
Returns the section label background paint.
|
AbstractPieLabelDistributor |
getLabelDistributor()
Returns the object responsible for the vertical layout of the pie
section labels.
|
Font |
getLabelFont()
Returns the section label font.
|
double |
getLabelGap()
Returns the gap between the edge of the pie and the labels, expressed as
a percentage of the plot width.
|
PieSectionLabelGenerator |
getLabelGenerator()
Returns the section label generator.
|
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.
|
double |
getLabelLinkMargin()
Returns the margin (expressed as a percentage of the width or height)
between the edge of the pie and the link point.
|
Paint |
getLabelLinkPaint()
Returns the paint used for the lines that connect pie sections to their
corresponding labels.
|
Stroke |
getLabelLinkStroke()
Returns the stroke used for the label linking lines.
|
PieLabelLinkStyle |
getLabelLinkStyle()
Returns the label link style.
|
boolean |
getLabelLinksVisible()
Returns the flag that controls whether or not label linking lines are
visible.
|
Paint |
getLabelOutlinePaint()
Returns the section label outline paint.
|
Stroke |
getLabelOutlineStroke()
Returns the section label outline stroke.
|
RectangleInsets |
getLabelPadding()
Returns the label padding.
|
Paint |
getLabelPaint()
Returns the section label paint.
|
Paint |
getLabelShadowPaint()
Returns the section label shadow paint.
|
LegendItemCollection |
getLegendItems()
Returns a collection of legend items for the pie chart.
|
Shape |
getLegendItemShape()
Returns the shape used for legend items.
|
PieSectionLabelGenerator |
getLegendLabelGenerator()
Returns the legend label generator.
|
PieSectionLabelGenerator |
getLegendLabelToolTipGenerator()
Returns the legend label tool tip generator.
|
PieURLGenerator |
getLegendLabelURLGenerator()
Returns the legend label URL generator.
|
double |
getMaximumExplodePercent()
Returns the maximum explode percent.
|
double |
getMaximumLabelWidth()
Returns the maximum label width as a percentage of the plot width.
|
double |
getMinimumArcAngleToDraw()
Returns the minimum arc angle that will be drawn.
|
int |
getPieIndex()
Returns the pie index (this is used by the
MultiplePiePlot class
to track subplots). |
String |
getPlotType()
Returns a short string describing the type of plot.
|
protected Comparable |
getSectionKey(int section)
Returns a key for the specified section.
|
Paint |
getSectionOutlinePaint(Comparable key)
Returns the outline paint associated with the specified key, or
null if there is no paint associated with the key. |
Stroke |
getSectionOutlineStroke(Comparable key)
Returns the outline stroke associated with the specified key, or
null if there is no stroke associated with the key. |
boolean |
getSectionOutlinesVisible()
Returns the flag that controls whether or not the outline is drawn for
each pie section.
|
Paint |
getSectionPaint(Comparable key)
Returns the paint associated with the specified key, or
null if there is no paint associated with the key. |
ShadowGenerator |
getShadowGenerator()
Returns the shadow generator for the plot, if any.
|
Paint |
getShadowPaint()
Returns the shadow paint.
|
double |
getShadowXOffset()
Returns the x-offset for the shadow effect.
|
double |
getShadowYOffset()
Returns the y-offset for the shadow effect.
|
RectangleInsets |
getSimpleLabelOffset()
Returns the offset used for the simple labels, if they are displayed.
|
boolean |
getSimpleLabels()
Returns the flag that controls whether simple or extended labels are
displayed on the plot.
|
double |
getStartAngle()
Returns the start angle for the first pie section.
|
PieToolTipGenerator |
getToolTipGenerator()
Returns the tool tip generator, an object that is responsible for
generating the text items used for tool tips by the plot.
|
PieURLGenerator |
getURLGenerator()
Returns the URL generator.
|
void |
handleMouseWheelRotation(int rotateClicks)
Handles a mouse wheel rotation (this method is intended for use by the
MouseWheelHandler class). |
PiePlotState |
initialise(Graphics2D g2,
Rectangle2D plotArea,
PiePlot plot,
Integer index,
PlotRenderingInfo info)
Initialises the drawing procedure.
|
boolean |
isCircular()
Returns a flag indicating whether the pie chart is circular, or
stretched into an elliptical shape.
|
protected Paint |
lookupSectionOutlinePaint(Comparable key)
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 |
lookupSectionOutlineStroke(Comparable key)
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 |
lookupSectionPaint(Comparable key)
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.
|
void |
setAutoPopulateSectionOutlinePaint(boolean auto)
Sets the flag that controls whether or not the section outline paint is
auto-populated by the
lookupSectionOutlinePaint(Comparable)
method, and sends a PlotChangeEvent to all registered listeners. |
void |
setAutoPopulateSectionOutlineStroke(boolean auto)
Sets the flag that controls whether or not the section outline stroke is
auto-populated by the
lookupSectionOutlineStroke(Comparable)
method, and sends a PlotChangeEvent to all registered listeners. |
void |
setAutoPopulateSectionPaint(boolean auto)
Sets the flag that controls whether or not the section paint is
auto-populated by the
lookupSectionPaint(Comparable) method,
and sends a PlotChangeEvent 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 a
PlotChangeEvent to all registered listeners. |
void |
setDataset(PieDataset dataset)
Sets the dataset and sends a
DatasetChangeEvent to 'this'. |
void |
setDefaultSectionOutlinePaint(Paint paint)
Sets the default section paint.
|
void |
setDefaultSectionOutlineStroke(Stroke stroke)
Sets the default section stroke.
|
void |
setDefaultSectionPaint(Paint paint)
Sets the default section paint and sends a
PlotChangeEvent to all
registered listeners. |
void |
setDirection(Rotation direction)
Sets the direction in which the pie sections are drawn and sends a
PlotChangeEvent to all registered listeners. |
void |
setExplodePercent(Comparable key,
double percent)
Sets the amount that a pie section should be exploded and sends a
PlotChangeEvent to all registered listeners. |
void |
setIgnoreNullValues(boolean flag)
Sets a flag that controls whether
null values are ignored,
and sends a PlotChangeEvent to all registered listeners. |
void |
setIgnoreZeroValues(boolean flag)
Sets a flag that controls whether zero values are ignored,
and sends a
PlotChangeEvent to all registered listeners. |
void |
setInteriorGap(double percent)
Sets the interior gap and sends a
PlotChangeEvent to all
registered listeners. |
void |
setLabelBackgroundPaint(Paint paint)
Sets the section label background paint and sends a
PlotChangeEvent to all registered listeners. |
void |
setLabelDistributor(AbstractPieLabelDistributor distributor)
Sets the label distributor and sends a
PlotChangeEvent to all
registered listeners. |
void |
setLabelFont(Font font)
Sets the section label font and sends a
PlotChangeEvent 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 a
PlotChangeEvent to all
registered listeners. |
void |
setLabelGenerator(PieSectionLabelGenerator generator)
Sets the section label generator and sends a
PlotChangeEvent to
all registered listeners. |
void |
setLabelLinkMargin(double margin)
Sets the link margin and sends a
PlotChangeEvent 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 a
PlotChangeEvent to all
registered listeners. |
void |
setLabelLinkStroke(Stroke stroke)
Sets the link stroke and sends a
PlotChangeEvent to all
registered listeners. |
void |
setLabelLinkStyle(PieLabelLinkStyle style)
Sets the label link style and sends a
PlotChangeEvent to all
registered listeners. |
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. |
void |
setLabelOutlinePaint(Paint paint)
Sets the section label outline paint and sends a
PlotChangeEvent to all registered listeners. |
void |
setLabelOutlineStroke(Stroke stroke)
Sets the section label outline stroke and sends a
PlotChangeEvent to all registered listeners. |
void |
setLabelPadding(RectangleInsets padding)
Sets the padding between each label and its outline and sends a
PlotChangeEvent to all registered listeners. |
void |
setLabelPaint(Paint paint)
Sets the section label paint and sends a
PlotChangeEvent to all
registered listeners. |
void |
setLabelShadowPaint(Paint paint)
Sets the section label shadow paint and sends a
PlotChangeEvent
to all registered listeners. |
void |
setLegendItemShape(Shape shape)
Sets the shape used for legend items and sends a
PlotChangeEvent
to all registered listeners. |
void |
setLegendLabelGenerator(PieSectionLabelGenerator generator)
Sets the legend label generator and sends a
PlotChangeEvent to
all registered listeners. |
void |
setLegendLabelToolTipGenerator(PieSectionLabelGenerator generator)
Sets the legend label tool tip generator and sends a
PlotChangeEvent to all registered listeners. |
void |
setLegendLabelURLGenerator(PieURLGenerator generator)
Sets the legend label URL generator and sends a
PlotChangeEvent to all registered listeners. |
void |
setMaximumLabelWidth(double width)
Sets the maximum label width as a percentage of the plot width and sends
a
PlotChangeEvent 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 the
MultiplePiePlot class to
track subplots). |
void |
setSectionOutlinePaint(Comparable key,
Paint paint)
Sets the outline paint associated with the specified key, and sends a
PlotChangeEvent to all registered listeners. |
void |
setSectionOutlineStroke(Comparable key,
Stroke stroke)
Sets the outline stroke associated with the specified key, and sends a
PlotChangeEvent 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 a
PlotChangeEvent to all registered
listeners. |
void |
setSectionPaint(Comparable key,
Paint paint)
Sets the paint associated with the specified key, and sends a
PlotChangeEvent to all registered listeners. |
void |
setShadowGenerator(ShadowGenerator generator)
Sets the shadow generator for the plot and sends a
PlotChangeEvent to all registered listeners. |
void |
setShadowPaint(Paint paint)
Sets the shadow paint and sends a
PlotChangeEvent to all
registered listeners. |
void |
setShadowXOffset(double offset)
Sets the x-offset for the shadow effect and sends a
PlotChangeEvent to all registered listeners. |
void |
setShadowYOffset(double offset)
Sets the y-offset for the shadow effect and sends a
PlotChangeEvent to all registered listeners. |
void |
setSimpleLabelOffset(RectangleInsets offset)
Sets the offset for the simple labels and sends a
PlotChangeEvent 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 a
PlotChangeEvent to all
registered listeners. |
void |
setStartAngle(double angle)
Sets the starting angle and sends a
PlotChangeEvent to all
registered listeners. |
void |
setToolTipGenerator(PieToolTipGenerator generator)
Sets the tool tip generator and sends a
PlotChangeEvent to all
registered listeners. |
void |
setURLGenerator(PieURLGenerator generator)
Sets the URL generator and sends a
PlotChangeEvent to all
registered listeners. |
addChangeListener, annotationChanged, axisChanged, createAndAddEntity, datasetChanged, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fetchElementHintingFlag, fillBackground, fillBackground, fireChangeEvent, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getChart, 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, setChart, setDatasetGroup, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setNotify, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParent, zoom
public static final double DEFAULT_INTERIOR_GAP
public static final double MAX_INTERIOR_GAP
public static final double DEFAULT_START_ANGLE
public static final Font DEFAULT_LABEL_FONT
public static final Paint DEFAULT_LABEL_PAINT
public static final Paint DEFAULT_LABEL_BACKGROUND_PAINT
public static final Paint DEFAULT_LABEL_OUTLINE_PAINT
public static final Stroke DEFAULT_LABEL_OUTLINE_STROKE
public static final Paint DEFAULT_LABEL_SHADOW_PAINT
public static final double DEFAULT_MINIMUM_ARC_ANGLE_TO_DRAW
protected static ResourceBundle localizationResources
public PiePlot()
null
.public PiePlot(PieDataset dataset)
dataset
- the dataset (null
permitted).public PieDataset getDataset()
null
).setDataset(PieDataset)
public void setDataset(PieDataset dataset)
DatasetChangeEvent
to 'this'.dataset
- the dataset (null
permitted).getDataset()
public int getPieIndex()
MultiplePiePlot
class
to track subplots).setPieIndex(int)
public void setPieIndex(int index)
MultiplePiePlot
class to
track subplots).index
- the index.getPieIndex()
public double getStartAngle()
setStartAngle(double)
public void setStartAngle(double angle)
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.angle
- the angle (in degrees).getStartAngle()
public Rotation getDirection()
null
).setDirection(Rotation)
public void setDirection(Rotation direction)
PlotChangeEvent
to all registered listeners.direction
- the direction (null
not permitted).getDirection()
public double getInteriorGap()
setInteriorGap(double)
public void setInteriorGap(double percent)
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).percent
- the gap (as a percentage of the available drawing space).getInteriorGap()
public boolean isCircular()
setCircular(boolean)
public void setCircular(boolean flag)
flag
- the new value.isCircular()
public void setCircular(boolean circular, boolean notify)
PlotChangeEvent
to all registered listeners.circular
- the new value of the flag.notify
- notify listeners?isCircular()
public boolean getIgnoreNullValues()
null
values in the
dataset are ignored.setIgnoreNullValues(boolean)
public void setIgnoreNullValues(boolean flag)
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.flag
- the flag.getIgnoreNullValues()
,
setIgnoreZeroValues(boolean)
public boolean getIgnoreZeroValues()
setIgnoreZeroValues(boolean)
public void setIgnoreZeroValues(boolean flag)
PlotChangeEvent
to all registered listeners. This
only affects whether or not a label appears for the non-visible
pie section.flag
- the flag.getIgnoreZeroValues()
,
setIgnoreNullValues(boolean)
protected Paint lookupSectionPaint(Comparable key)
lookupSectionPaint(section, getAutoPopulateSectionPaint())
.key
- the section key.lookupSectionPaint(Comparable, boolean)
protected Paint lookupSectionPaint(Comparable key, boolean autoPopulate)
getSectionPaint(Comparable)
is non-null
return
it;getSectionPaint(Comparable)
is null
but
autoPopulate
is true
, attempt to fetch
a new paint from the drawing supplier
(Plot.getDrawingSupplier()
);
getDefaultSectionPaint()
.
key
- the section key.autoPopulate
- a flag that controls whether the drawing supplier
is used to auto-populate the section paint settings.protected Comparable getSectionKey(int section)
section
- the section index.public Paint getSectionPaint(Comparable key)
null
if there is no paint associated with the key.key
- the key (null
not permitted).null
.IllegalArgumentException
- if key
is
null
.setSectionPaint(Comparable, Paint)
public void setSectionPaint(Comparable key, Paint paint)
PlotChangeEvent
to all registered listeners.key
- the key (null
not permitted).paint
- the paint.IllegalArgumentException
- if key
is
null
.getSectionPaint(Comparable)
public void clearSectionPaints(boolean notify)
PlotChangeEvent
to all registered listeners. Be aware that
if the autoPopulateSectionPaint
flag is set, the section
paints may be repopulated using the same colours as before.notify
- notify listeners?autoPopulateSectionPaint
public Paint getDefaultSectionPaint()
Color.GRAY
.null
).setDefaultSectionPaint(Paint)
public void setDefaultSectionPaint(Paint paint)
PlotChangeEvent
to all
registered listeners.paint
- the paint (null
not permitted).getDefaultSectionPaint()
public boolean getAutoPopulateSectionPaint()
lookupSectionPaint(Comparable)
method.public void setAutoPopulateSectionPaint(boolean auto)
lookupSectionPaint(Comparable)
method,
and sends a PlotChangeEvent
to all registered listeners.auto
- auto-populate?public boolean getSectionOutlinesVisible()
setSectionOutlinesVisible(boolean)
public void setSectionOutlinesVisible(boolean visible)
PlotChangeEvent
to all registered
listeners.visible
- the flag.getSectionOutlinesVisible()
protected Paint lookupSectionOutlinePaint(Comparable key)
lookupSectionPaint(section,
getAutoPopulateSectionOutlinePaint())
.key
- the section key.lookupSectionOutlinePaint(Comparable, boolean)
protected Paint lookupSectionOutlinePaint(Comparable key, boolean autoPopulate)
getSectionOutlinePaint(Comparable)
is
non-null
return it;getSectionOutlinePaint(Comparable)
is null
but
autoPopulate
is true
, attempt to fetch
a new outline paint from the drawing supplier
(Plot.getDrawingSupplier()
);
getDefaultSectionOutlinePaint()
.
key
- the section key.autoPopulate
- a flag that controls whether the drawing supplier
is used to auto-populate the section outline paint settings.public Paint getSectionOutlinePaint(Comparable key)
null
if there is no paint associated with the key.key
- the key (null
not permitted).null
.IllegalArgumentException
- if key
is
null
.setSectionOutlinePaint(Comparable, Paint)
public void setSectionOutlinePaint(Comparable key, Paint paint)
PlotChangeEvent
to all registered listeners.key
- the key (null
not permitted).paint
- the paint.IllegalArgumentException
- if key
is
null
.getSectionOutlinePaint(Comparable)
public void clearSectionOutlinePaints(boolean notify)
PlotChangeEvent
to all registered listeners.
Be aware that if the autoPopulateSectionPaint
flag is set,
the section paints may be repopulated using the same colours as before.notify
- notify listeners?autoPopulateSectionOutlinePaint
public Paint getDefaultSectionOutlinePaint()
null
).setDefaultSectionOutlinePaint(Paint)
public void setDefaultSectionOutlinePaint(Paint paint)
paint
- the paint (null
not permitted).getDefaultSectionOutlinePaint()
public boolean getAutoPopulateSectionOutlinePaint()
lookupSectionOutlinePaint(Comparable)
method.public void setAutoPopulateSectionOutlinePaint(boolean auto)
lookupSectionOutlinePaint(Comparable)
method, and sends a PlotChangeEvent
to all registered listeners.auto
- auto-populate?protected Stroke lookupSectionOutlineStroke(Comparable key)
lookupSectionOutlineStroke(section,
getAutoPopulateSectionOutlineStroke())
.key
- the section key.lookupSectionOutlineStroke(Comparable, boolean)
protected Stroke lookupSectionOutlineStroke(Comparable key, boolean autoPopulate)
getSectionOutlineStroke(Comparable)
is
non-null
return it;getSectionOutlineStroke(Comparable)
is null
but
autoPopulate
is true
, attempt to fetch
a new outline stroke from the drawing supplier
(Plot.getDrawingSupplier()
);
getDefaultSectionOutlineStroke()
.
key
- the section key.autoPopulate
- a flag that controls whether the drawing supplier
is used to auto-populate the section outline stroke settings.public Stroke getSectionOutlineStroke(Comparable key)
null
if there is no stroke associated with the key.key
- the key (null
not permitted).null
.IllegalArgumentException
- if key
is
null
.setSectionOutlineStroke(Comparable, Stroke)
public void setSectionOutlineStroke(Comparable key, Stroke stroke)
PlotChangeEvent
to all registered listeners.key
- the key (null
not permitted).stroke
- the stroke.IllegalArgumentException
- if key
is
null
.getSectionOutlineStroke(Comparable)
public void clearSectionOutlineStrokes(boolean notify)
PlotChangeEvent
to all registered listeners.
Be aware that if the autoPopulateSectionPaint
flag is set,
the section paints may be repopulated using the same colours as before.notify
- notify listeners?autoPopulateSectionOutlineStroke
public Stroke getDefaultSectionOutlineStroke()
null
).setDefaultSectionOutlineStroke(Stroke)
public void setDefaultSectionOutlineStroke(Stroke stroke)
stroke
- the stroke (null
not permitted).getDefaultSectionOutlineStroke()
public boolean getAutoPopulateSectionOutlineStroke()
lookupSectionOutlinePaint(Comparable)
method.public void setAutoPopulateSectionOutlineStroke(boolean auto)
lookupSectionOutlineStroke(Comparable)
method, and sends a PlotChangeEvent
to all registered listeners.auto
- auto-populate?public Paint getShadowPaint()
null
).setShadowPaint(Paint)
public void setShadowPaint(Paint paint)
PlotChangeEvent
to all
registered listeners.paint
- the paint (null
permitted).getShadowPaint()
public double getShadowXOffset()
setShadowXOffset(double)
public void setShadowXOffset(double offset)
PlotChangeEvent
to all registered listeners.offset
- the offset (in Java2D units).getShadowXOffset()
public double getShadowYOffset()
setShadowYOffset(double)
public void setShadowYOffset(double offset)
PlotChangeEvent
to all registered listeners.offset
- the offset (in Java2D units).getShadowYOffset()
public double getExplodePercent(Comparable key)
key
- the key (null
not permitted).IllegalArgumentException
- if key
is
null
.setExplodePercent(Comparable, double)
public void setExplodePercent(Comparable key, double percent)
PlotChangeEvent
to all registered listeners.key
- the section key (null
not permitted).percent
- the explode percentage (0.30 = 30 percent).getExplodePercent(Comparable)
public double getMaximumExplodePercent()
public PieSectionLabelGenerator getLabelGenerator()
null
).setLabelGenerator(PieSectionLabelGenerator)
public void setLabelGenerator(PieSectionLabelGenerator generator)
PlotChangeEvent
to
all registered listeners.generator
- the generator (null
permitted).getLabelGenerator()
public double getLabelGap()
setLabelGap(double)
public void setLabelGap(double gap)
PlotChangeEvent
to all
registered listeners.gap
- the gap (a percentage, where 0.05 = five percent).getLabelGap()
public double getMaximumLabelWidth()
setMaximumLabelWidth(double)
public void setMaximumLabelWidth(double width)
PlotChangeEvent
to all registered listeners.width
- the width (a percentage, where 0.20 = 20 percent).getMaximumLabelWidth()
public boolean getLabelLinksVisible()
setLabelLinksVisible(boolean)
public void setLabelLinksVisible(boolean visible)
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.visible
- the flag.getLabelLinksVisible()
public PieLabelLinkStyle getLabelLinkStyle()
null
).setLabelLinkStyle(PieLabelLinkStyle)
public void setLabelLinkStyle(PieLabelLinkStyle style)
PlotChangeEvent
to all
registered listeners.style
- the new style (null
not permitted).getLabelLinkStyle()
public double getLabelLinkMargin()
setLabelLinkMargin(double)
public void setLabelLinkMargin(double margin)
PlotChangeEvent
to all
registered listeners.margin
- the margin.getLabelLinkMargin()
public Paint getLabelLinkPaint()
null
).setLabelLinkPaint(Paint)
public void setLabelLinkPaint(Paint paint)
PlotChangeEvent
to all
registered listeners.paint
- the paint (null
not permitted).getLabelLinkPaint()
public Stroke getLabelLinkStroke()
setLabelLinkStroke(Stroke)
public void setLabelLinkStroke(Stroke stroke)
PlotChangeEvent
to all
registered listeners.stroke
- the stroke.getLabelLinkStroke()
protected double getLabelLinkDepth()
RingPlot
class to resolve
bug 2121818.0.10
.public Font getLabelFont()
null
).setLabelFont(Font)
public void setLabelFont(Font font)
PlotChangeEvent
to all
registered listeners.font
- the font (null
not permitted).getLabelFont()
public Paint getLabelPaint()
null
).setLabelPaint(Paint)
public void setLabelPaint(Paint paint)
PlotChangeEvent
to all
registered listeners.paint
- the paint (null
not permitted).getLabelPaint()
public Paint getLabelBackgroundPaint()
null
).setLabelBackgroundPaint(Paint)
public void setLabelBackgroundPaint(Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the paint (null
permitted).getLabelBackgroundPaint()
public Paint getLabelOutlinePaint()
null
).setLabelOutlinePaint(Paint)
public void setLabelOutlinePaint(Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the paint (null
permitted).getLabelOutlinePaint()
public Stroke getLabelOutlineStroke()
null
).setLabelOutlineStroke(Stroke)
public void setLabelOutlineStroke(Stroke stroke)
PlotChangeEvent
to all registered listeners.stroke
- the stroke (null
permitted).getLabelOutlineStroke()
public Paint getLabelShadowPaint()
null
).setLabelShadowPaint(Paint)
public void setLabelShadowPaint(Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the paint (null
permitted).getLabelShadowPaint()
public RectangleInsets getLabelPadding()
null
).setLabelPadding(RectangleInsets)
public void setLabelPadding(RectangleInsets padding)
PlotChangeEvent
to all registered listeners.padding
- the padding (null
not permitted).getLabelPadding()
public boolean getSimpleLabels()
public void setSimpleLabels(boolean simple)
PlotChangeEvent
to all
registered listeners.simple
- the new flag value.public RectangleInsets getSimpleLabelOffset()
null
).setSimpleLabelOffset(RectangleInsets)
public void setSimpleLabelOffset(RectangleInsets offset)
PlotChangeEvent
to all registered listeners.offset
- the offset (null
not permitted).getSimpleLabelOffset()
public AbstractPieLabelDistributor getLabelDistributor()
null
).public void setLabelDistributor(AbstractPieLabelDistributor distributor)
PlotChangeEvent
to all
registered listeners.distributor
- the distributor (null
not permitted).public PieToolTipGenerator getToolTipGenerator()
null
, no tool tips will be created.null
).setToolTipGenerator(PieToolTipGenerator)
public void setToolTipGenerator(PieToolTipGenerator generator)
PlotChangeEvent
to all
registered listeners. Set the generator to null
if you
don't want any tool tips.generator
- the generator (null
permitted).getToolTipGenerator()
public PieURLGenerator getURLGenerator()
null
).setURLGenerator(PieURLGenerator)
public void setURLGenerator(PieURLGenerator generator)
PlotChangeEvent
to all
registered listeners.generator
- the generator (null
permitted).getURLGenerator()
public double getMinimumArcAngleToDraw()
setMinimumArcAngleToDraw(double)
public void setMinimumArcAngleToDraw(double angle)
angle
- the minimum angle.getMinimumArcAngleToDraw()
public Shape getLegendItemShape()
null
).setLegendItemShape(Shape)
public void setLegendItemShape(Shape shape)
PlotChangeEvent
to all registered listeners.shape
- the shape (null
not permitted).getLegendItemShape()
public PieSectionLabelGenerator getLegendLabelGenerator()
null
).setLegendLabelGenerator(PieSectionLabelGenerator)
public void setLegendLabelGenerator(PieSectionLabelGenerator generator)
PlotChangeEvent
to
all registered listeners.generator
- the generator (null
not permitted).getLegendLabelGenerator()
public PieSectionLabelGenerator getLegendLabelToolTipGenerator()
null
).setLegendLabelToolTipGenerator(PieSectionLabelGenerator)
public void setLegendLabelToolTipGenerator(PieSectionLabelGenerator generator)
PlotChangeEvent
to all registered listeners.generator
- the generator (null
permitted).getLegendLabelToolTipGenerator()
public PieURLGenerator getLegendLabelURLGenerator()
null
).setLegendLabelURLGenerator(PieURLGenerator)
public void setLegendLabelURLGenerator(PieURLGenerator generator)
PlotChangeEvent
to all registered listeners.generator
- the generator (null
permitted).getLegendLabelURLGenerator()
public ShadowGenerator getShadowGenerator()
null
).public void setShadowGenerator(ShadowGenerator generator)
PlotChangeEvent
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 the
setShadowPaint(java.awt.Paint)
method.generator
- the generator (null
permitted).public void handleMouseWheelRotation(int rotateClicks)
MouseWheelHandler
class).rotateClicks
- the number of rotate clicks on the the mouse wheel.public PiePlotState initialise(Graphics2D g2, Rectangle2D plotArea, PiePlot plot, Integer index, PlotRenderingInfo info)
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.public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info)
protected void drawPie(Graphics2D g2, Rectangle2D plotArea, PlotRenderingInfo info)
g2
- the graphics device.plotArea
- the plot area.info
- chart rendering info.protected void drawItem(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass)
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.protected void drawSimpleLabels(Graphics2D g2, List keys, double totalValue, Rectangle2D plotArea, Rectangle2D pieArea, PiePlotState state)
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.protected void drawLabels(Graphics2D g2, List keys, double totalValue, Rectangle2D plotArea, Rectangle2D linkArea, PiePlotState state)
g2
- the graphics device.keys
- the keys.totalValue
- the total value.plotArea
- the plot area.linkArea
- the link area.state
- the state.protected void drawLeftLabels(KeyedValues leftKeys, Graphics2D g2, Rectangle2D plotArea, Rectangle2D linkArea, float maxLabelWidth, PiePlotState state)
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.protected void drawRightLabels(KeyedValues keys, Graphics2D g2, Rectangle2D plotArea, Rectangle2D linkArea, float maxLabelWidth, PiePlotState state)
keys
- the keys.g2
- the graphics device.plotArea
- the plot area.linkArea
- the link area.maxLabelWidth
- the maximum label width.state
- the state.public LegendItemCollection getLegendItems()
getLegendItems
in interface LegendItemSource
getLegendItems
in class Plot
null
).public String getPlotType()
getPlotType
in class Plot
protected Rectangle2D getArcBounds(Rectangle2D unexploded, Rectangle2D exploded, double angle, double extent, double explodePercent)
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.protected void drawLeftLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record)
g2
- the graphics device.state
- the state.record
- the label record.protected void drawRightLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record)
g2
- the graphics device.state
- the state.record
- the label record.protected Point2D getArcCenter(PiePlotState state, Comparable key)
state
- PiePlotStatekey
- section key.protected Paint lookupSectionPaint(Comparable key, PiePlotState state)
lookupSectionPaint(section)
. Checks to see if the user set the
Paint
to be of type RadialGradientPaint
and if so it
adjusts the center and radius to match the Pie.key
- the section key.state
- PiePlotState.public boolean equals(Object obj)
public Object clone() throws CloneNotSupportedException
clone
in interface PublicCloneable
clone
in class Plot
CloneNotSupportedException
- if some component of the plot does
not support cloning.Copyright © 2001–2017 JFree.org. All rights reserved.