Save This Page
Home » jcommon-1.0.13 » org.jfree » chart » plot » [javadoc | source]
org.jfree.chart.plot
public class: PiePlot [javadoc | source]
java.lang.Object
   org.jfree.chart.plot.Plot
      org.jfree.chart.plot.PiePlot

All Implemented Interfaces:
    Cloneable, Serializable, PublicCloneable, AxisChangeListener, LegendItemSource, MarkerChangeListener, DatasetChangeListener

Direct Known Subclasses:
    RingPlot, PiePlot3D

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

Special notes:

  1. the default starting point is 12 o'clock and the pie sections proceed in a clockwise direction, but these settings can be changed;
  2. negative values in the dataset are ignored;
  3. there are utility methods for creating a PieDataset from a org.jfree.data.category.CategoryDataset ;
Field Summary
public static final  double DEFAULT_INTERIOR_GAP    The default interior gap. 
public static final  double MAX_INTERIOR_GAP    The maximum interior gap (currently 40%). 
public static final  double DEFAULT_START_ANGLE    The default starting angle for the pie chart. 
public static final  Font DEFAULT_LABEL_FONT    The default section label font. 
public static final  Paint DEFAULT_LABEL_PAINT    The default section label paint. 
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. 
protected static  ResourceBundle localizationResources    The resourceBundle for the localization. 
static final  boolean DEBUG_DRAW_INTERIOR    This 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. 
static final  boolean DEBUG_DRAW_LINK_AREA    This 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. 
static final  boolean DEBUG_DRAW_PIE_AREA    This debug flag controls whether or not an outline is drawn showing the pie area (in green). 
Fields inherited from org.jfree.chart.plot.Plot:
ZERO,  DEFAULT_INSETS,  DEFAULT_OUTLINE_STROKE,  DEFAULT_OUTLINE_PAINT,  DEFAULT_FOREGROUND_ALPHA,  DEFAULT_BACKGROUND_ALPHA,  DEFAULT_BACKGROUND_PAINT,  MINIMUM_WIDTH_TO_DRAW,  MINIMUM_HEIGHT_TO_DRAW,  DEFAULT_LEGEND_ITEM_BOX,  DEFAULT_LEGEND_ITEM_CIRCLE
Constructor:
 public PiePlot() 
 public PiePlot(PieDataset dataset) 
    Creates a plot that will draw a pie chart for the specified dataset.
    Parameters:
    dataset - the dataset (null permitted).
Method from org.jfree.chart.plot.PiePlot Summary:
clone,   draw,   drawItem,   drawLabels,   drawLeftLabel,   drawLeftLabels,   drawPie,   drawRightLabel,   drawRightLabels,   drawSimpleLabels,   equals,   getArcBounds,   getBaseSectionOutlinePaint,   getBaseSectionOutlineStroke,   getBaseSectionPaint,   getDataset,   getDirection,   getExplodePercent,   getExplodePercent,   getIgnoreNullValues,   getIgnoreZeroValues,   getInteriorGap,   getLabelBackgroundPaint,   getLabelDistributor,   getLabelFont,   getLabelGap,   getLabelGenerator,   getLabelLinkMargin,   getLabelLinkPaint,   getLabelLinkStroke,   getLabelLinkStyle,   getLabelLinksVisible,   getLabelOutlinePaint,   getLabelOutlineStroke,   getLabelPadding,   getLabelPaint,   getLabelShadowPaint,   getLegendItemShape,   getLegendItems,   getLegendLabelGenerator,   getLegendLabelToolTipGenerator,   getLegendLabelURLGenerator,   getMaximumExplodePercent,   getMaximumLabelWidth,   getMinimumArcAngleToDraw,   getPieIndex,   getPlotType,   getSectionKey,   getSectionOutlinePaint,   getSectionOutlinePaint,   getSectionOutlinePaint,   getSectionOutlineStroke,   getSectionOutlineStroke,   getSectionOutlineStroke,   getSectionOutlinesVisible,   getSectionPaint,   getSectionPaint,   getSectionPaint,   getShadowPaint,   getShadowXOffset,   getShadowYOffset,   getSimpleLabelOffset,   getSimpleLabels,   getStartAngle,   getToolTipGenerator,   getURLGenerator,   initialise,   isCircular,   lookupSectionOutlinePaint,   lookupSectionOutlinePaint,   lookupSectionOutlineStroke,   lookupSectionOutlineStroke,   lookupSectionPaint,   lookupSectionPaint,   setBaseSectionOutlinePaint,   setBaseSectionOutlineStroke,   setBaseSectionPaint,   setCircular,   setCircular,   setDataset,   setDirection,   setExplodePercent,   setExplodePercent,   setIgnoreNullValues,   setIgnoreZeroValues,   setInteriorGap,   setLabelBackgroundPaint,   setLabelDistributor,   setLabelFont,   setLabelGap,   setLabelGenerator,   setLabelLinkMargin,   setLabelLinkPaint,   setLabelLinkStroke,   setLabelLinkStyle,   setLabelLinksVisible,   setLabelOutlinePaint,   setLabelOutlineStroke,   setLabelPadding,   setLabelPaint,   setLabelShadowPaint,   setLegendItemShape,   setLegendLabelGenerator,   setLegendLabelToolTipGenerator,   setLegendLabelURLGenerator,   setMaximumLabelWidth,   setMinimumArcAngleToDraw,   setPieIndex,   setSectionOutlinePaint,   setSectionOutlinePaint,   setSectionOutlinePaint,   setSectionOutlineStroke,   setSectionOutlineStroke,   setSectionOutlineStroke,   setSectionOutlinesVisible,   setSectionPaint,   setSectionPaint,   setSectionPaint,   setShadowPaint,   setShadowXOffset,   setShadowYOffset,   setSimpleLabelOffset,   setSimpleLabels,   setStartAngle,   setToolTipGenerator,   setURLGenerator
Methods from org.jfree.chart.plot.Plot:
addChangeListener,   axisChanged,   clone,   datasetChanged,   draw,   drawBackground,   drawBackgroundImage,   drawNoDataMessage,   drawOutline,   equals,   fillBackground,   fillBackground,   fireChangeEvent,   getBackgroundAlpha,   getBackgroundImage,   getBackgroundImageAlignment,   getBackgroundImageAlpha,   getBackgroundPaint,   getDatasetGroup,   getDrawingSupplier,   getForegroundAlpha,   getInsets,   getLegendItems,   getNoDataMessage,   getNoDataMessageFont,   getNoDataMessagePaint,   getOutlinePaint,   getOutlineStroke,   getParent,   getPlotType,   getRectX,   getRectY,   getRootPlot,   handleClick,   isOutlineVisible,   isSubplot,   markerChanged,   notifyListeners,   removeChangeListener,   resolveDomainAxisLocation,   resolveRangeAxisLocation,   setBackgroundAlpha,   setBackgroundImage,   setBackgroundImageAlignment,   setBackgroundImageAlpha,   setBackgroundPaint,   setDatasetGroup,   setDrawingSupplier,   setForegroundAlpha,   setInsets,   setInsets,   setNoDataMessage,   setNoDataMessageFont,   setNoDataMessagePaint,   setOutlinePaint,   setOutlineStroke,   setOutlineVisible,   setParent,   zoom
Methods from java.lang.Object:
equals,   getClass,   hashCode,   notify,   notifyAll,   toString,   wait,   wait,   wait
Method from org.jfree.chart.plot.PiePlot Detail:
 public Object clone() throws CloneNotSupportedException 
    Returns a clone of the plot.
 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).
 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.
 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.
 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').
 public Paint getBaseSectionOutlinePaint() 
    Returns the base section paint. This is used when no other paint is available.
 public Stroke getBaseSectionOutlineStroke() 
    Returns the base section stroke. This is used when no other stroke is available.
 public Paint getBaseSectionPaint() 
    Returns the base section paint. This is used when no other paint is defined, which is rare. The default value is Color.gray.
 public PieDataset getDataset() 
    Returns the dataset.
 public Rotation getDirection() 
    Returns the direction in which the pie sections are drawn (clockwise or anti-clockwise).
 public double getExplodePercent(Comparable key) 
    Returns the amount that the section with the specified key should be exploded.
 public double getExplodePercent(int section) 
Deprecated! Use - #getExplodePercent(Comparable) instead.

    Returns the amount that a section should be 'exploded'.
 public boolean getIgnoreNullValues() 
    Returns the flag that controls whether null values in the dataset are ignored.
 public boolean getIgnoreZeroValues() 
    Returns the flag that controls whether zero values in the dataset are ignored.
 public double getInteriorGap() 
    Returns the interior gap, measured as a percentage of the available drawing space.
 public Paint getLabelBackgroundPaint() 
    Returns the section label background paint.
 public AbstractPieLabelDistributor getLabelDistributor() 
    Returns the object responsible for the vertical layout of the pie section labels.
 public Font getLabelFont() 
    Returns the section label font.
 public double getLabelGap() 
    Returns the gap between the edge of the pie and the labels, expressed as a percentage of the plot width.
 public PieSectionLabelGenerator getLabelGenerator() 
    Returns the section label generator.
 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.
 public Paint getLabelLinkPaint() 
    Returns the paint used for the lines that connect pie sections to their corresponding labels.
 public Stroke getLabelLinkStroke() 
    Returns the stroke used for the label linking lines.
 public PieLabelLinkStyle getLabelLinkStyle() 
    Returns the label link style.
 public boolean getLabelLinksVisible() 
    Returns the flag that controls whether or not label linking lines are visible.
 public Paint getLabelOutlinePaint() 
    Returns the section label outline paint.
 public Stroke getLabelOutlineStroke() 
    Returns the section label outline stroke.
 public RectangleInsets getLabelPadding() 
    Returns the label padding.
 public Paint getLabelPaint() 
    Returns the section label paint.
 public Paint getLabelShadowPaint() 
    Returns the section label shadow paint.
 public Shape getLegendItemShape() 
    Returns the shape used for legend items.
 public LegendItemCollection getLegendItems() 
    Returns a collection of legend items for the pie chart.
 public PieSectionLabelGenerator getLegendLabelGenerator() 
    Returns the legend label generator.
 public PieSectionLabelGenerator getLegendLabelToolTipGenerator() 
    Returns the legend label tool tip generator.
 public PieURLGenerator getLegendLabelURLGenerator() 
    Returns the legend label URL generator.
 public double getMaximumExplodePercent() 
    Returns the maximum explode percent.
 public double getMaximumLabelWidth() 
    Returns the maximum label width as a percentage of the plot width.
 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.
 public int getPieIndex() 
    Returns the pie index (this is used by the MultiplePiePlot class to track subplots).
 public String getPlotType() 
    Returns a short string describing the type of plot.
 protected Comparable getSectionKey(int section) 
    Returns a key for the specified section. If there is no such section in the dataset, we generate a key. This is to provide some backward compatibility for the (now deprecated) methods that get/set attributes based on section indices. The preferred way of doing this now is to link the attributes directly to the section key (there are new methods for this, starting from version 1.0.3).
 public Paint getSectionOutlinePaint() 
Deprecated! Use - #getSectionOutlinePaint(Comparable) and #getBaseSectionOutlinePaint() . Deprecated as of version 1.0.6.

    Returns the outline paint for ALL sections in the plot.
 public Paint getSectionOutlinePaint(Comparable key) 
    Returns the outline paint associated with the specified key, or null if there is no paint associated with the key.
 public Paint getSectionOutlinePaint(int section) 
Deprecated! Use - #getSectionOutlinePaint(Comparable) instead.

    Returns the paint for the specified section.
 public Stroke getSectionOutlineStroke() 
Deprecated! Use - #getSectionOutlineStroke(Comparable) and #getBaseSectionOutlineStroke() . Deprecated as of version 1.0.6.

    Returns the outline stroke for ALL sections in the plot.
 public Stroke getSectionOutlineStroke(Comparable key) 
    Returns the outline stroke associated with the specified key, or null if there is no stroke associated with the key.
 public Stroke getSectionOutlineStroke(int section) 
Deprecated! Use - #getSectionOutlineStroke(Comparable) instead.

    Returns the stroke for the specified section.
 public boolean getSectionOutlinesVisible() 
    Returns the flag that controls whether or not the outline is drawn for each pie section.
 public Paint getSectionPaint() 
Deprecated! Use - #getSectionPaint(Comparable) and #getBaseSectionPaint() . Deprecated as of version 1.0.6.

    Returns the paint for ALL sections in the plot.
 public Paint getSectionPaint(Comparable key) 
    Returns the paint associated with the specified key, or null if there is no paint associated with the key.
 public Paint getSectionPaint(int section) 
Deprecated! Use - #getSectionPaint(Comparable) instead.

    Returns the paint for the specified section.
 public Paint getShadowPaint() 
    Returns the shadow paint.
 public double getShadowXOffset() 
    Returns the x-offset for the shadow effect.
 public double getShadowYOffset() 
    Returns the y-offset for the shadow effect.
 public RectangleInsets getSimpleLabelOffset() 
    Returns the offset used for the simple labels, if they are displayed.
 public boolean getSimpleLabels() 
    Returns the flag that controls whether simple or extended labels are displayed on the plot.
 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.
 public PieToolTipGenerator getToolTipGenerator() 
    Returns the tool tip generator, an object that is responsible for generating the text items used for tool tips by the plot. If the generator is null, no tool tips will be created.
 public PieURLGenerator getURLGenerator() 
    Returns the URL generator.
 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.
 public 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. This is equivalent to lookupSectionPaint(section, false).
 protected Paint lookupSectionOutlinePaint(Comparable key,
    boolean autoPopulate) 
 protected Stroke lookupSectionOutlineStroke(Comparable key) 
    Returns the outline stroke for the specified section. This is equivalent to lookupSectionOutlineStroke(section, false).
 protected Stroke lookupSectionOutlineStroke(Comparable key,
    boolean autoPopulate) 
 protected Paint lookupSectionPaint(Comparable key) 
    Returns the paint for the specified section. This is equivalent to lookupSectionPaint(section, false).
 protected Paint lookupSectionPaint(Comparable key,
    boolean autoPopulate) 
 public  void setBaseSectionOutlinePaint(Paint paint) 
    Sets the base section paint.
 public  void setBaseSectionOutlineStroke(Stroke stroke) 
    Sets the base section stroke.
 public  void setBaseSectionPaint(Paint paint) 
    Sets the base section paint and sends a PlotChangeEvent to all registered listeners.
 public  void setCircular(boolean flag) 
    A flag indicating whether the pie chart is circular, or stretched into an elliptical shape.
 public  void setCircular(boolean circular,
    boolean notify) 
    Sets the circular attribute and, if requested, sends a PlotChangeEvent to all registered listeners.
 public  void setDataset(PieDataset dataset) 
 public  void setDirection(Rotation direction) 
    Sets the direction in which the pie sections are drawn and sends a PlotChangeEvent to all registered listeners.
 public  void setExplodePercent(Comparable key,
    double percent) 
    Sets the amount that a pie section should be exploded and sends a PlotChangeEvent to all registered listeners.
 public  void setExplodePercent(int section,
    double percent) 
Deprecated! Use - #setExplodePercent(Comparable, double) instead.

    Sets the amount that a pie section should be exploded and sends a PlotChangeEvent to all registered listeners.
 public  void setIgnoreNullValues(boolean flag) 
    Sets a flag that controls whether null values are ignored, and sends a PlotChangeEvent to all registered listeners. At present, this only affects whether or not the key is presented in the legend.
 public  void setIgnoreZeroValues(boolean flag) 
    Sets a flag that controls whether zero values are ignored, and sends a PlotChangeEvent to all registered listeners. This only affects whether or not a label appears for the non-visible pie section.
 public  void setInteriorGap(double percent) 
    Sets the interior gap and sends a PlotChangeEvent to all registered listeners. This controls the space between the edges of the pie plot and the plot area itself (the region where the section labels appear).
 public  void setLabelBackgroundPaint(Paint paint) 
    Sets the section label background paint and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelDistributor(AbstractPieLabelDistributor distributor) 
    Sets the label distributor and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelFont(Font font) 
    Sets the section label font and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelGap(double gap) 
    Sets the gap between the edge of the pie and the labels (expressed as a percentage of the plot width) and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelGenerator(PieSectionLabelGenerator generator) 
    Sets the section label generator and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelLinkMargin(double margin) 
    Sets the link margin and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelLinkPaint(Paint paint) 
    Sets the paint used for the lines that connect pie sections to their corresponding labels, and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelLinkStroke(Stroke stroke) 
    Sets the link stroke and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelLinkStyle(PieLabelLinkStyle style) 
    Sets the label link style and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelLinksVisible(boolean visible) 
    Sets the flag that controls whether or not label linking lines are visible and sends a PlotChangeEvent to all registered listeners. Please take care when hiding the linking lines - depending on the data values, the labels can be displayed some distance away from the corresponding pie section.
 public  void setLabelOutlinePaint(Paint paint) 
    Sets the section label outline paint and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelOutlineStroke(Stroke stroke) 
    Sets the section label outline stroke and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelPadding(RectangleInsets padding) 
    Sets the padding between each label and its outline and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelPaint(Paint paint) 
    Sets the section label paint and sends a PlotChangeEvent to all registered listeners.
 public  void setLabelShadowPaint(Paint paint) 
    Sets the section label shadow paint and sends a PlotChangeEvent to all registered listeners.
 public  void setLegendItemShape(Shape shape) 
    Sets the shape used for legend items and sends a PlotChangeEvent to all registered listeners.
 public  void setLegendLabelGenerator(PieSectionLabelGenerator generator) 
    Sets the legend label generator and sends a PlotChangeEvent to all registered listeners.