- java.lang.Object
-
- org.jfree.chart.plot.Plot
-
- org.jfree.chart.plot.pie.MultiplePiePlot
-
- All Implemented Interfaces:
Serializable,Cloneable,EventListener,PublicCloneable,ChartElement,AnnotationChangeListener,AxisChangeListener,MarkerChangeListener,org.jfree.chart.legend.LegendItemSource,DatasetChangeListener
public class MultiplePiePlot extends Plot implements Cloneable, Serializable
A plot that displays multiple pie plots using data from aCategoryDataset.- See Also:
- Serialized Form
-
-
Field Summary
-
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
Constructors Constructor Description MultiplePiePlot()Creates a new plot with no data.MultiplePiePlot(CategoryDataset dataset)Creates a new plot.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Objectclone()Returns a clone of the plot.voiddraw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info)Draws the plot on a Java 2D graphics device (such as the screen or a printer).booleanequals(Object obj)Tests this plot for equality with an arbitrary object.ComparablegetAggregatedItemsKey()Returns the key for aggregated items in the pie plots, if there are any.PaintgetAggregatedItemsPaint()Returns the paint used to draw the pie section representing the aggregated items.TableOrdergetDataExtractOrder()Returns the data extract order (by row or by column).CategoryDatasetgetDataset()Returns the dataset used by the plot.org.jfree.chart.legend.LegendItemCollectiongetLegendItems()Returns a collection of legend items for the pie chart.ShapegetLegendItemShape()Returns the shape used for legend items.doublegetLimit()Returns the limit (as a percentage) below which small pie sections are aggregated.JFreeChartgetPieChart()Returns the pie chart that is used to draw the individual pie plots.StringgetPlotType()Returns a short string describing the type of plot.voidsetAggregatedItemsKey(Comparable key)Sets the key for aggregated items in the pie plots.voidsetAggregatedItemsPaint(Paint paint)Sets the paint used to draw the pie section representing the aggregated items and sends aPlotChangeEventto all registered listeners.voidsetDataExtractOrder(TableOrder order)Sets the data extract order (by row or by column) and sends aPlotChangeEventto all registered listeners.voidsetDataset(CategoryDataset dataset)Sets the dataset used by the plot and sends aPlotChangeEventto all registered listeners.voidsetLegendItemShape(Shape shape)Sets the shape used for legend items and sends aPlotChangeEventto all registered listeners.voidsetLimit(double limit)Sets the limit below which pie sections are aggregated.voidsetPieChart(JFreeChart pieChart)Sets the chart that is used to draw the individual pie plots.-
Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, annotationChanged, axisChanged, createAndAddEntity, datasetChanged, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fetchElementHintingFlag, fillBackground, fillBackground, fireChangeEvent, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getChart, getDrawingSupplier, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, handleClick, isNotify, isOutlineVisible, isSubplot, markerChanged, notifyListeners, receive, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setChart, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setNotify, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParent, zoom
-
-
-
-
Constructor Detail
-
MultiplePiePlot
public MultiplePiePlot()
Creates a new plot with no data.
-
MultiplePiePlot
public MultiplePiePlot(CategoryDataset dataset)
Creates a new plot.- Parameters:
dataset- the dataset (nullpermitted).
-
-
Method Detail
-
getDataset
public CategoryDataset getDataset()
Returns the dataset used by the plot.- Returns:
- The dataset (possibly
null).
-
setDataset
public void setDataset(CategoryDataset dataset)
Sets the dataset used by the plot and sends aPlotChangeEventto all registered listeners.- Parameters:
dataset- the dataset (nullpermitted).
-
getPieChart
public JFreeChart getPieChart()
Returns the pie chart that is used to draw the individual pie plots. Note that there are some attributes on this chart instance that will be ignored at rendering time (for example, legend item settings).- Returns:
- The pie chart (never
null). - See Also:
setPieChart(JFreeChart)
-
setPieChart
public void setPieChart(JFreeChart pieChart)
Sets the chart that is used to draw the individual pie plots. The chart's plot must be an instance ofPiePlot.- Parameters:
pieChart- the pie chart (nullnot permitted).- See Also:
getPieChart()
-
getDataExtractOrder
public TableOrder getDataExtractOrder()
Returns the data extract order (by row or by column).- Returns:
- The data extract order (never
null).
-
setDataExtractOrder
public void setDataExtractOrder(TableOrder order)
Sets the data extract order (by row or by column) and sends aPlotChangeEventto all registered listeners.- Parameters:
order- the order (nullnot permitted).
-
getLimit
public double getLimit()
Returns the limit (as a percentage) below which small pie sections are aggregated.- Returns:
- The limit percentage.
-
setLimit
public void setLimit(double limit)
Sets the limit below which pie sections are aggregated. Set this to 0.0 if you don't want any aggregation to occur.- Parameters:
limit- the limit percent.
-
getAggregatedItemsKey
public Comparable getAggregatedItemsKey()
Returns the key for aggregated items in the pie plots, if there are any. The default value is "Other".- Returns:
- The aggregated items key.
-
setAggregatedItemsKey
public void setAggregatedItemsKey(Comparable key)
Sets the key for aggregated items in the pie plots. You must ensure that this doesn't clash with any keys in the dataset.- Parameters:
key- the key (nullnot permitted).
-
getAggregatedItemsPaint
public Paint getAggregatedItemsPaint()
Returns the paint used to draw the pie section representing the aggregated items. The default value is {code Color.lightGray}.- Returns:
- The paint.
-
setAggregatedItemsPaint
public void setAggregatedItemsPaint(Paint paint)
Sets the paint used to draw the pie section representing the aggregated items and sends aPlotChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).
-
getPlotType
public String getPlotType()
Returns a short string describing the type of plot.- Specified by:
getPlotTypein classPlot- Returns:
- The plot type.
-
getLegendItemShape
public Shape getLegendItemShape()
Returns the shape used for legend items.- Returns:
- The shape (never
null). - See Also:
setLegendItemShape(Shape)
-
setLegendItemShape
public void setLegendItemShape(Shape shape)
Sets the shape used for legend items and sends aPlotChangeEventto all registered listeners.- Parameters:
shape- the shape (nullnot permitted).- See Also:
getLegendItemShape()
-
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).
-
getLegendItems
public org.jfree.chart.legend.LegendItemCollection getLegendItems()
Returns a collection of legend items for the pie chart.- Specified by:
getLegendItemsin interfaceorg.jfree.chart.legend.LegendItemSource- Overrides:
getLegendItemsin classPlot- Returns:
- The legend items.
-
equals
public boolean equals(Object obj)
Tests this plot for equality with an arbitrary object. Note that the plot's dataset is not considered in the equality test.
-
clone
public Object clone() throws CloneNotSupportedException
Returns a clone of the plot.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classPlot- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if some component of the plot does not support cloning.
-
-