Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.jfree.chart.plot.Plot
org.jfree.chart.plot.PiePlot
PieDataset
interface.
Special notes:
PieDataset
from a
CategoryDataset
;Plot
, PieDataset
Field Summary | |
static double |
|
static Paint |
|
static Font |
|
static Paint |
|
static Stroke |
|
static Paint |
|
static Paint |
|
static double |
|
static double |
|
static double |
|
protected static ResourceBundle |
|
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 | |
| |
|
Method Summary | |
Object |
|
void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
boolean |
|
protected Rectangle2D |
|
Paint |
|
Stroke |
|
Paint |
|
PieDataset |
|
Rotation |
|
double |
|
boolean |
|
boolean |
|
double |
|
Paint |
|
Font |
|
double |
|
PieSectionLabelGenerator |
|
double |
|
Paint |
|
Stroke |
|
boolean |
|
Paint |
|
Stroke |
|
Paint |
|
Paint |
|
Shape |
|
LegendItemCollection |
|
PieSectionLabelGenerator |
|
PieSectionLabelGenerator |
|
double |
|
double |
|
double |
|
int |
|
String |
|
Paint |
|
Paint |
|
Stroke |
|
Stroke |
|
boolean |
|
Paint |
|
Paint |
|
Paint |
|
double |
|
double |
|
double |
|
PieToolTipGenerator |
|
PieURLGenerator |
|
PiePlotState |
|
boolean |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
public static final double DEFAULT_INTERIOR_GAP
The default interior gap.
- Field Value:
- 0.0
public static final Paint DEFAULT_LABEL_BACKGROUND_PAINT
The default section label background paint.
public static final Paint DEFAULT_LABEL_OUTLINE_PAINT
The default section label outline paint.
public static final Stroke DEFAULT_LABEL_OUTLINE_STROKE
The default section label outline stroke.
public static final Paint DEFAULT_LABEL_SHADOW_PAINT
The default section label shadow paint.
public static final double DEFAULT_MINIMUM_ARC_ANGLE_TO_DRAW
The default minimum arc angle to draw.
- Field Value:
- 0.0
public static final double DEFAULT_START_ANGLE
The default starting angle for the pie chart.
- Field Value:
- 90.0
public static final double MAX_INTERIOR_GAP
The maximum interior gap (currently 40%).
- Field Value:
- 0.0
protected static ResourceBundle localizationResources
The resourceBundle for the localization.
public PiePlot(PieDataset dataset)
Creates a plot that will draw a pie chart for the specified dataset.
- Parameters:
dataset
- the dataset (null
permitted).
public Object clone() throws CloneNotSupportedException
Returns a clone of the plot.
- Returns:
- A clone.
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info)
Draws the plot on a Java 2D graphics device (such as the screen or a printer).
- Parameters:
g2
- the graphics device.area
- the area within which the plot should be drawn.anchor
- the anchor point (null
permitted).parentState
- the state from the parent plot, if there is one.info
- collects info about the drawing (null
permitted).
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.
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.
protected void drawLeftLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record)
Draws a section label on the left side of the pie chart.
- Parameters:
g2
- the graphics device.state
- the state.record
- the label record.
protected void drawLeftLabels(KeyedValues leftKeys, Graphics2D g2, Rectangle2D plotArea, Rectangle2D linkArea, float maxLabelWidth, PiePlotState state)
Draws the left labels.
- Parameters:
leftKeys
- the keys.g2
- the graphics device.plotArea
- the plot area.linkArea
- the link area.maxLabelWidth
- the maximum label width.state
- the state.
protected void drawPie(Graphics2D g2, Rectangle2D plotArea, PlotRenderingInfo info)
Draws the pie.
- Parameters:
g2
- the graphics device.plotArea
- the plot area.info
- chart rendering info.
protected void drawRightLabel(Graphics2D g2, PiePlotState state, PieLabelRecord record)
Draws a section label on the right side of the pie chart.
- Parameters:
g2
- the graphics device.state
- the state.record
- the label record.
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.
public boolean equals(Object obj)
Tests this plot for equality with an arbitrary object. Note that the plot's dataset is NOT included in the test for equality.
- Parameters:
obj
- the object to test against (null
permitted).
- Returns:
true
orfalse
.
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.
public Paint getBaseSectionOutlinePaint()
Returns the base section paint. This is used when no other paint is available.
- Returns:
- The paint (never
null
).
public Stroke getBaseSectionOutlineStroke()
Returns the base section stroke. This is used when no other stroke is available.
- Returns:
- The stroke (never
null
).
public Paint getBaseSectionPaint()
Returns the base section paint. This is used when no other paint is available.
- Returns:
- The paint (never
null
).
public Rotation getDirection()
Returns the direction in which the pie sections are drawn (clockwise or anti-clockwise).
- Returns:
- The direction (never
null
).
public double getExplodePercent(int section)
Returns the amount that a section should be 'exploded'.
- Parameters:
section
- the section number.
- Returns:
- The amount that a section should be 'exploded'.
public boolean getIgnoreNullValues()
Returns the flag that controls whethernull
values in the dataset are ignored.
- Returns:
- A boolean.
public boolean getIgnoreZeroValues()
Returns the flag that controls whether zero values in the dataset are ignored.
- Returns:
- A boolean.
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).
public Paint getLabelBackgroundPaint()
Returns the section label background paint.
- Returns:
- The paint (possibly
null
).
public Font getLabelFont()
Returns the section label font.
- Returns:
- The font (never
null
).
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).
public PieSectionLabelGenerator getLabelGenerator()
Returns the section label generator.
- Returns:
- The generator (possibly
null
).
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).
public Paint getLabelLinkPaint()
Returns the paint used for the lines that connect pie sections to their corresponding labels.
- Returns:
- The paint (never
null
).
public Stroke getLabelLinkStroke()
Returns the stroke used for the label linking lines.
- Returns:
- The stroke.
public boolean getLabelLinksVisible()
Returns the flag that controls whether or not label linking lines are visible.
- Returns:
- A boolean.
public Paint getLabelOutlinePaint()
Returns the section label outline paint.
- Returns:
- The paint (possibly
null
).
public Stroke getLabelOutlineStroke()
Returns the section label outline stroke.
- Returns:
- The stroke (possibly
null
).
public Paint getLabelPaint()
Returns the section label paint.
- Returns:
- The paint (never
null
).
public Paint getLabelShadowPaint()
Returns the section label shadow paint.
- Returns:
- The paint (possibly
null
).
public Shape getLegendItemShape()
Returns the shape used for legend items.
- Returns:
- The shape.
public LegendItemCollection getLegendItems()
Returns a collection of legend items for the pie chart.
- Specified by:
- getLegendItems in interface LegendItemSource
- Overrides:
- getLegendItems in interface Plot
- Returns:
- The legend items (never
null
).
public PieSectionLabelGenerator getLegendLabelGenerator()
Returns the legend label generator.
- Returns:
- The legend label generator (never
null
).
public PieSectionLabelGenerator getLegendLabelToolTipGenerator()
Returns the legend label tool tip generator.
- Returns:
- The legend label tool tip generator (possibly
null
).
public double getMaximumExplodePercent()
Returns the maximum explode percent.
- Returns:
- The percent.
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).
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.
public int getPieIndex()
Returns the pie index (this is used by theMultiplePiePlot
class to track subplots).
- Returns:
- The pie index.
public String getPlotType()
Returns a short string describing the type of plot.
- Overrides:
- getPlotType in interface Plot
- Returns:
- The plot type.
public Paint getSectionOutlinePaint()
Returns the outline paint for ALL sections in the plot.
- Returns:
- The paint (possibly
null
).
public Paint getSectionOutlinePaint(int section)
Returns the paint for the specified section.
- Parameters:
section
- the section index (zero-based).
- Returns:
- The paint (never
null
).
public Stroke getSectionOutlineStroke()
Returns the outline stroke for ALL sections in the plot.
- Returns:
- The stroke (possibly
null
).
public Stroke getSectionOutlineStroke(int section)
Returns the stroke for the specified section.
- Parameters:
section
- the section index (zero-based).
- Returns:
- The stroke (never
null
).
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.
public Paint getSectionPaint()
Returns the paint for ALL sections in the plot.
- Returns:
- The paint (possibly
null
).
public Paint getSectionPaint(int section)
Returns the paint for the specified section.
- Parameters:
section
- the section index (zero-based).
- Returns:
- The paint (never
null
).
public Paint getShadowPaint()
Returns the shadow paint.
- Returns:
- The paint (possibly
null
).
public double getShadowXOffset()
Returns the x-offset for the shadow effect.
- Returns:
- The offset (in Java2D units).
public double getShadowYOffset()
Returns the y-offset for the shadow effect.
- Returns:
- The offset (in Java2D units).
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.
public PieToolTipGenerator getToolTipGenerator()
Returns the tool tip generator, an object that is responsible for generating the text items used for tool tips by the plot. If the generator isnull
, no tool tips will be created.
- Returns:
- The generator (possibly
null
).
public PieURLGenerator getURLGenerator()
Returns the URL generator.
- Returns:
- The generator (possibly
null
).
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).
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.
public void setBaseSectionOutlinePaint(Paint paint)
Sets the base section paint.
- Parameters:
paint
- the paint (null
not permitted).
public void setBaseSectionOutlineStroke(Stroke stroke)
Sets the base section stroke.
- Parameters:
stroke
- the stroke (null
not permitted).
public void setBaseSectionPaint(Paint paint)
Sets the base section paint.
- Parameters:
paint
- the paint (null
not permitted).
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.
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?
public void setDataset(PieDataset dataset)
Sets the dataset and sends aDatasetChangeEvent
to 'this'.
- Parameters:
dataset
- the dataset (null
permitted).
public void setDirection(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).
public void setExplodePercent(int section, double percent)
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).
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.
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.
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).
public void setLabelBackgroundPaint(Paint paint)
Sets the section label background paint and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint (null
permitted).
public void setLabelFont(Font font)
Sets the section label font and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
font
- the font (null
not permitted).
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).
public void setLabelGenerator(PieSectionLabelGenerator generator)
Sets the section label generator and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
generator
- the generator (null
permitted).
public void setLabelLinkMargin(double margin)
Sets the link margin and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
margin
- the margin.
public 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.
- Parameters:
paint
- the paint (null
not permitted).
public void setLabelLinkStroke(Stroke stroke)
Sets the link stroke and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
stroke
- the stroke.
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.
public void setLabelOutlinePaint(Paint paint)
Sets the section label outline paint and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint (null
permitted).
public void setLabelOutlineStroke(Stroke stroke)
Sets the section label outline stroke and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
stroke
- the stroke (null
permitted).
public void setLabelPaint(Paint paint)
Sets the section label paint and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint (null
not permitted).
public void setLabelShadowPaint(Paint paint)
Sets the section label shadow paint and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint (null
permitted).
public void setLegendItemShape(Shape shape)
Sets the shape used for legend items.
- Parameters:
shape
- the shape (null
not permitted).
public void setLegendLabelGenerator(PieSectionLabelGenerator generator)
Sets the legend label generator and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
generator
- the generator (null
not permitted).
public void setLegendLabelToolTipGenerator(PieSectionLabelGenerator generator)
Sets the legend label tool tip generator and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
generator
- the generator (null
permitted).
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).
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.
public void setPieIndex(int index)
Sets the pie index (this is used by theMultiplePiePlot
class to track subplots).
- Parameters:
index
- the index.
public void setSectionOutlinePaint(Paint paint)
Sets the outline paint for ALL sections in the plot. If this is set to null, then a list of paints is used instead (to allow different colors to be used for each section).
- Parameters:
paint
- the paint (null
permitted).
public void setSectionOutlinePaint(int section, Paint paint)
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).
public void setSectionOutlineStroke(Stroke stroke)
Sets the outline stroke for ALL sections in the plot. If this is set to null, then a list of paints is used instead (to allow different colors to be used for each section).
- Parameters:
stroke
- the stroke (null
permitted).
public void setSectionOutlineStroke(int section, Stroke stroke)
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).
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.
public void setSectionPaint(Paint paint)
Sets the paint for ALL sections in the plot. If this is set to null, then a list of paints is used instead (to allow different colors to be used for each section).
- Parameters:
paint
- the paint (null
permitted).
public void setSectionPaint(int section, Paint paint)
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).
public void setShadowPaint(Paint paint)
Sets the shadow paint and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint (null
permitted).
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).
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).
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).
public void setToolTipGenerator(PieToolTipGenerator generator)
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).
public void setURLGenerator(PieURLGenerator generator)
Sets the URL generator and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
generator
- the generator (null
permitted).