org.jfree.chart.plot

Class RingPlot

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

public class RingPlot
extends PiePlot
implements Cloneable, Serializable

A customised pie plot that leaves a hole in the middle.

Field Summary

Fields inherited from class org.jfree.chart.plot.PiePlot

DEFAULT_INTERIOR_GAP, DEFAULT_LABEL_BACKGROUND_PAINT, DEFAULT_LABEL_FONT, DEFAULT_LABEL_OUTLINE_PAINT, DEFAULT_LABEL_OUTLINE_STROKE, DEFAULT_LABEL_PAINT, DEFAULT_LABEL_SHADOW_PAINT, DEFAULT_MINIMUM_ARC_ANGLE_TO_DRAW, DEFAULT_START_ANGLE, MAX_INTERIOR_GAP, localizationResources

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

RingPlot()
Creates a new plot with a null dataset.
RingPlot(PieDataset dataset)
Creates a new plot for the specified dataset.

Method Summary

protected void
drawItem(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass)
Draws a single data item.
boolean
equals(Object obj)
Tests this plot for equality with an arbitrary object.
double
getInnerSeparatorExtension()
Returns the length of the inner extension of the separator line that is drawn between sections, expressed as a percentage of the depth of the section.
double
getOuterSeparatorExtension()
Returns the length of the outer extension of the separator line that is drawn between sections, expressed as a percentage of the depth of the section.
double
getSectionDepth()
Returns the depth of each section, expressed as a percentage of the plot radius.
Paint
getSeparatorPaint()
Returns the separator paint.
Stroke
getSeparatorStroke()
Returns the separator stroke.
boolean
getSeparatorsVisible()
Returns a flag that indicates whether or not separators are drawn between the sections in the chart.
PiePlotState
initialise(Graphics2D g2, Rectangle2D plotArea, PiePlot plot, Integer index, PlotRenderingInfo info)
Initialises the plot state (which will store the total of all dataset values, among other things).
void
setInnerSeparatorExtension(double percent)
Sets the length of the inner extension of the separator line that is drawn between sections, as a percentage of the depth of the sections, and sends a PlotChangeEvent to all registered listeners.
void
setOuterSeparatorExtension(double percent)
Sets the length of the outer extension of the separator line that is drawn between sections, as a percentage of the depth of the sections, and sends a PlotChangeEvent to all registered listeners.
void
setSectionDepth(double sectionDepth)
The section depth is given as percentage of the plot radius.
void
setSeparatorPaint(Paint paint)
Sets the paint used to draw the separator between sections and sends a PlotChangeEvent to all registered listeners.
void
setSeparatorStroke(Stroke stroke)
Sets the stroke used to draw the separator between sections and sends a PlotChangeEvent to all registered listeners.
void
setSeparatorsVisible(boolean visible)
Sets the flag that controls whether or not separators are drawn between the sections in the chart, and sends a PlotChangeEvent to all registered listeners.

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

clone, draw, drawItem, drawLabels, drawLeftLabel, drawLeftLabels, drawPie, drawRightLabel, drawRightLabels, equals, getArcBounds, getBaseSectionOutlinePaint, getBaseSectionOutlineStroke, getBaseSectionPaint, getDataset, getDirection, getExplodePercent, getExplodePercent, getIgnoreNullValues, getIgnoreZeroValues, getInteriorGap, getLabelBackgroundPaint, getLabelFont, getLabelGap, getLabelGenerator, getLabelLinkMargin, getLabelLinkPaint, getLabelLinkStroke, getLabelLinksVisible, getLabelOutlinePaint, getLabelOutlineStroke, 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, getStartAngle, getToolTipGenerator, getURLGenerator, initialise, isCircular, lookupSectionOutlinePaint, lookupSectionOutlinePaint, lookupSectionOutlineStroke, lookupSectionOutlineStroke, lookupSectionPaint, lookupSectionPaint, setBaseSectionOutlinePaint, setBaseSectionOutlineStroke, setBaseSectionPaint, setCircular, setCircular, setDataset, setDirection, setExplodePercent, setExplodePercent, setIgnoreNullValues, setIgnoreZeroValues, setInteriorGap, setLabelBackgroundPaint, setLabelFont, setLabelGap, setLabelGenerator, setLabelLinkMargin, setLabelLinkPaint, setLabelLinkStroke, setLabelLinksVisible, setLabelOutlinePaint, setLabelOutlineStroke, setLabelPaint, setLabelShadowPaint, setLegendItemShape, setLegendLabelGenerator, setLegendLabelToolTipGenerator, setLegendLabelURLGenerator, setMaximumLabelWidth, setMinimumArcAngleToDraw, setPieIndex, setSectionOutlinePaint, setSectionOutlinePaint, setSectionOutlinePaint, setSectionOutlineStroke, setSectionOutlineStroke, setSectionOutlineStroke, setSectionOutlinesVisible, setSectionPaint, setSectionPaint, setSectionPaint, setShadowPaint, setShadowXOffset, setShadowYOffset, setStartAngle, setToolTipGenerator, setURLGenerator, zoom

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

RingPlot

public RingPlot()
Creates a new plot with a null dataset.

RingPlot

public RingPlot(PieDataset dataset)
Creates a new plot for the specified dataset.
Parameters:
dataset - the dataset (null permitted).

Method Details

drawItem

protected void drawItem(Graphics2D g2,
                        int section,
                        Rectangle2D dataArea,
                        PiePlotState state,
                        int currentPass)
Draws a single data item.
Overrides:
drawItem in interface PiePlot
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.

equals

public boolean equals(Object obj)
Tests this plot for equality with an arbitrary object.
Overrides:
equals in interface PiePlot
Parameters:
obj - the object to test against (null permitted).
Returns:
A boolean.

getInnerSeparatorExtension

public double getInnerSeparatorExtension()
Returns the length of the inner extension of the separator line that is drawn between sections, expressed as a percentage of the depth of the section.
Returns:
The inner separator extension (as a percentage).

getOuterSeparatorExtension

public double getOuterSeparatorExtension()
Returns the length of the outer extension of the separator line that is drawn between sections, expressed as a percentage of the depth of the section.
Returns:
The outer separator extension (as a percentage).

getSectionDepth

public double getSectionDepth()
Returns the depth of each section, expressed as a percentage of the plot radius.
Returns:
The depth of each section.
Since:
1.0.3

getSeparatorPaint

public Paint getSeparatorPaint()
Returns the separator paint.
Returns:
The paint (never null).

getSeparatorStroke

public Stroke getSeparatorStroke()
Returns the separator stroke.
Returns:
The stroke (never null).

getSeparatorsVisible

public boolean getSeparatorsVisible()
Returns a flag that indicates whether or not separators are drawn between the sections in the chart.
Returns:
A boolean.

initialise

public PiePlotState initialise(Graphics2D g2,
                               Rectangle2D plotArea,
                               PiePlot plot,
                               Integer index,
                               PlotRenderingInfo info)
Initialises the plot state (which will store the total of all dataset values, among other things). This method is called once at the beginning of each drawing.
Overrides:
initialise in interface PiePlot
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).

setInnerSeparatorExtension

public void setInnerSeparatorExtension(double percent)
Sets the length of the inner extension of the separator line that is drawn between sections, as a percentage of the depth of the sections, and sends a PlotChangeEvent to all registered listeners.
Parameters:
percent - the percentage.

setOuterSeparatorExtension

public void setOuterSeparatorExtension(double percent)
Sets the length of the outer extension of the separator line that is drawn between sections, as a percentage of the depth of the sections, and sends a PlotChangeEvent to all registered listeners.
Parameters:
percent - the percentage.

setSectionDepth

public void setSectionDepth(double sectionDepth)
The section depth is given as percentage of the plot radius. Specifying 1.0 results in a straightforward pie chart.
Parameters:
sectionDepth - the section depth.
Since:
1.0.3

setSeparatorPaint

public void setSeparatorPaint(Paint paint)
Sets the paint used to draw the separator between sections and sends a PlotChangeEvent to all registered listeners.
Parameters:
paint - the paint (null not permitted).

setSeparatorStroke

public void setSeparatorStroke(Stroke stroke)
Sets the stroke used to draw the separator between sections and sends a PlotChangeEvent to all registered listeners.
Parameters:
stroke - the stroke (null not permitted).

setSeparatorsVisible

public void setSeparatorsVisible(boolean visible)
Sets the flag that controls whether or not separators are drawn between the sections in the chart, and sends a PlotChangeEvent to all registered listeners.
Parameters:
visible - the flag.