org.jfree.chart.plot

Class MultiplePiePlot

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

public class MultiplePiePlot
extends Plot
implements Cloneable, Serializable

A plot that displays multiple pie plots using data from a CategoryDataset.

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

MultiplePiePlot()
Creates a new plot with no data.
MultiplePiePlot(CategoryDataset dataset)
Creates a new plot.

Method Summary

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).
boolean
equals(Object obj)
Tests this plot for equality with an arbitrary object.
Comparable
getAggregatedItemsKey()
Returns the key for aggregated items in the pie plots, if there are any.
Paint
getAggregatedItemsPaint()
Returns the paint used to draw the pie section representing the aggregated items.
TableOrder
getDataExtractOrder()
Returns the data extract order (by row or by column).
CategoryDataset
getDataset()
Returns the dataset used by the plot.
LegendItemCollection
getLegendItems()
Returns a collection of legend items for the pie chart.
double
getLimit()
Returns the limit (as a percentage) below which small pie sections are aggregated.
JFreeChart
getPieChart()
Returns the pie chart that is used to draw the individual pie plots.
String
getPlotType()
Returns a short string describing the type of plot.
void
setAggregatedItemsKey(Comparable key)
Sets the key for aggregated items in the pie plots.
void
setAggregatedItemsPaint(Paint paint)
Sets the paint used to draw the pie section representing the aggregated items and sends a PlotChangeEvent to all registered listeners.
void
setDataExtractOrder(TableOrder order)
Sets the data extract order (by row or by column) and sends a PlotChangeEvent to all registered listeners.
void
setDataset(CategoryDataset dataset)
Sets the dataset used by the plot and sends a PlotChangeEvent to all registered listeners.
void
setLimit(double limit)
Sets the limit below which pie sections are aggregated.
void
setPieChart(JFreeChart pieChart)
Sets the chart that is used to draw the individual pie plots.

Methods inherited from class org.jfree.chart.plot.Plot

addChangeListener, axisChanged, clone, datasetChanged, draw, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, equals, fillBackground, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getLegendItems, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getPlotType, getRectX, getRectY, getRootPlot, handleClick, isSubplot, markerChanged, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setDatasetGroup, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setOutlinePaint, setOutlineStroke, setParent, zoom

Constructor Details

MultiplePiePlot

public MultiplePiePlot()
Creates a new plot with no data.

MultiplePiePlot

public MultiplePiePlot(CategoryDataset dataset)
Creates a new plot.
Parameters:
dataset - the dataset (null permitted).

Method Details

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).
Overrides:
draw in interface Plot
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.

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.
Overrides:
equals in interface Plot
Parameters:
obj - the object (null permitted).
Returns:
true if this plot is equal to obj, and false otherwise.

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.
Since:
1.0.2

getAggregatedItemsPaint

public Paint getAggregatedItemsPaint()
Returns the paint used to draw the pie section representing the aggregated items. The default value is Color.lightGray.
Returns:
The paint.
Since:
1.0.2

getDataExtractOrder

public TableOrder getDataExtractOrder()
Returns the data extract order (by row or by column).
Returns:
The data extract order (never null).

getDataset

public CategoryDataset getDataset()
Returns the dataset used by the plot.
Returns:
The dataset (possibly null).

getLegendItems

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.

getLimit

public double getLimit()
Returns the limit (as a percentage) below which small pie sections are aggregated.
Returns:
The limit percentage.

getPieChart

public JFreeChart getPieChart()
Returns the pie chart that is used to draw the individual pie plots.
Returns:
The pie chart.

getPlotType

public String getPlotType()
Returns a short string describing the type of plot.
Overrides:
getPlotType in interface Plot
Returns:
The plot type.

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 (null not permitted).
Since:
1.0.2

setAggregatedItemsPaint

public void setAggregatedItemsPaint(Paint paint)
Sets the paint used to draw the pie section representing the aggregated items and sends a PlotChangeEvent to all registered listeners.
Parameters:
paint - the paint (null not permitted).
Since:
1.0.2

setDataExtractOrder

public void setDataExtractOrder(TableOrder order)
Sets the data extract order (by row or by column) and sends a PlotChangeEvent to all registered listeners.
Parameters:
order - the order (null not permitted).

setDataset

public void setDataset(CategoryDataset dataset)
Sets the dataset used by the plot and sends a PlotChangeEvent to all registered listeners.
Parameters:
dataset - the dataset (null permitted).

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.

setPieChart

public void setPieChart(JFreeChart pieChart)
Sets the chart that is used to draw the individual pie plots.
Parameters:
pieChart - the pie chart.