java.lang.Object
org.jfree.chart.plot.Plot
org.jfree.chart.plot.PiePlot
org.jfree.chart.plot.RingPlot
- All Implemented Interfaces:
Disposable,Serializable,Cloneable,EventListener,AnnotationChangeListener,AxisChangeListener,MarkerChangeListener,LegendItemSource,PublicCloneable,DatasetChangeListener
A customised pie plot that leaves a hole in the middle.
- See Also:
-
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, localizationResources, MAX_INTERIOR_GAPFields 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
ConstructorsConstructorDescriptionRingPlot()Creates a new plot with anulldataset.RingPlot(PieDataset dataset) Creates a new plot for the specified dataset. -
Method Summary
Modifier and TypeMethodDescriptionprotected voiddrawItem(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass) Draws a single data item.booleanTests this plot for equality with an arbitrary object.Returns the text to display in the center of the plot when the mode isCenterTextMode.FIXED.Returns the color for the center text.Returns the font used to display the center text.Returns the formatter used to format the center text value for the modeCenterTextMode.VALUE.Returns the mode for displaying text in the center of the plot.doubleReturns 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.protected doubleThis method overrides the default value for cases where the ring plot is very thin.doubleReturns 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.doubleReturns the depth of each section, expressed as a percentage of the plot radius.Returns the separator paint.Returns the separator stroke.booleanReturns a flag that indicates whether or not separators are drawn between the sections in the chart.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).voidsetCenterText(String text) Sets the text to display in the center of the plot and sends a change event to all registered listeners.voidsetCenterTextColor(Color color) Sets the color for the center text and sends a change event to all registered listeners.voidsetCenterTextFont(Font font) Sets the font used to display the center text and sends a change event to all registered listeners.voidsetCenterTextFormatter(Format formatter) Sets the formatter used to format the center text value and sends a change event to all registered listeners.voidSets the mode for displaying text in the center of the plot and sends a change event to all registered listeners.voidsetInnerSeparatorExtension(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 change event to all registered listeners.voidsetOuterSeparatorExtension(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 change event to all registered listeners.voidsetSectionDepth(double sectionDepth) The section depth is given as percentage of the plot radius.voidsetSeparatorPaint(Paint paint) Sets the paint used to draw the separator between sections and sends a change event to all registered listeners.voidsetSeparatorStroke(Stroke stroke) Sets the stroke used to draw the separator between sections and sends a change event to all registered listeners.voidsetSeparatorsVisible(boolean visible) Sets the flag that controls whether or not separators are drawn between the sections in the chart, and sends a change event to all registered listeners.Methods inherited from class org.jfree.chart.plot.PiePlot
clearSectionOutlinePaints, clearSectionOutlineStrokes, clearSectionPaints, clone, dispose, draw, drawLabels, drawLeftLabel, drawLeftLabels, drawPie, drawRightLabel, drawRightLabels, drawSimpleLabels, getArcBounds, getArcCenter, getAutoPopulateSectionOutlinePaint, getAutoPopulateSectionOutlineStroke, getAutoPopulateSectionPaint, getDataset, getDefaultSectionOutlinePaint, getDefaultSectionOutlineStroke, getDefaultSectionPaint, getDirection, getExplodePercent, getIgnoreNullValues, getIgnoreZeroValues, getInteriorGap, getLabelBackgroundPaint, getLabelDistributor, getLabelFont, getLabelGap, getLabelGenerator, getLabelLinkMargin, getLabelLinkPaint, getLabelLinkStroke, getLabelLinkStyle, getLabelLinksVisible, getLabelOutlinePaint, getLabelOutlineStroke, getLabelPadding, getLabelPaint, getLabelShadowPaint, getLegendItems, getLegendItemShape, getLegendLabelGenerator, getLegendLabelToolTipGenerator, getLegendLabelURLGenerator, getMaximumExplodePercent, getMaximumLabelWidth, getMinimumArcAngleToDraw, getPieIndex, getPlotType, getSectionKey, getSectionOutlinePaint, getSectionOutlineStroke, getSectionOutlinesVisible, getSectionPaint, getShadowGenerator, getShadowPaint, getShadowXOffset, getShadowYOffset, getSimpleLabelOffset, getSimpleLabels, getStartAngle, getToolTipGenerator, getURLGenerator, handleMouseWheelRotation, hashCode, isCircular, lookupSectionOutlinePaint, lookupSectionOutlinePaint, lookupSectionOutlineStroke, lookupSectionOutlineStroke, lookupSectionPaint, lookupSectionPaint, lookupSectionPaint, setAutoPopulateSectionOutlinePaint, setAutoPopulateSectionOutlineStroke, setAutoPopulateSectionPaint, setCircular, setCircular, setDataset, setDefaultSectionOutlinePaint, setDefaultSectionOutlineStroke, setDefaultSectionPaint, setDirection, 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, setSectionOutlineStroke, setSectionOutlinesVisible, setSectionPaint, setShadowGenerator, setShadowPaint, setShadowXOffset, setShadowYOffset, setSimpleLabelOffset, setSimpleLabels, setStartAngle, setToolTipGenerator, setURLGeneratorMethods 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, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, handleClick, isNotify, isOutlineVisible, isSubplot, markerChanged, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setChart, setDatasetGroup, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setNotify, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParent, zoom
-
Constructor Details
-
RingPlot
public RingPlot()Creates a new plot with anulldataset. -
RingPlot
Creates a new plot for the specified dataset.- Parameters:
dataset- the dataset (nullpermitted).
-
-
Method Details
-
getCenterTextMode
Returns the mode for displaying text in the center of the plot. The default value isCenterTextMode.NONEtherefore no text will be displayed by default.- Returns:
- The mode (never
null).
-
setCenterTextMode
Sets the mode for displaying text in the center of the plot and sends a change event to all registered listeners. ForCenterTextMode.FIXED, the display text will come from thecenterTextattribute (seegetCenterText()). ForCenterTextMode.VALUE, the center text will be the value from the first section in the dataset.- Parameters:
mode- the mode (nullnot permitted).
-
getCenterText
Returns the text to display in the center of the plot when the mode isCenterTextMode.FIXED.- Returns:
- The text (possibly
null).
-
setCenterText
Sets the text to display in the center of the plot and sends a change event to all registered listeners. If the text is set tonull, no text will be displayed.- Parameters:
text- the text (nullpermitted).
-
getCenterTextFormatter
Returns the formatter used to format the center text value for the modeCenterTextMode.VALUE. The default value isDecimalFormat("0.00").- Returns:
- The formatter (never
null).
-
setCenterTextFormatter
Sets the formatter used to format the center text value and sends a change event to all registered listeners.- Parameters:
formatter- the formatter (nullnot permitted).
-
getCenterTextFont
Returns the font used to display the center text. The default value isPiePlot.DEFAULT_LABEL_FONT.- Returns:
- The font (never
null).
-
setCenterTextFont
Sets the font used to display the center text and sends a change event to all registered listeners.- Parameters:
font- the font (nullnot permitted).
-
getCenterTextColor
Returns the color for the center text. The default value isColor.BLACK.- Returns:
- The color (never
null).
-
setCenterTextColor
Sets the color for the center text and sends a change event to all registered listeners.- Parameters:
color- the color (nullnot permitted).
-
getSeparatorsVisible
public boolean getSeparatorsVisible()Returns a flag that indicates whether or not separators are drawn between the sections in the chart.- Returns:
- A boolean.
- See Also:
-
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 change event to all registered listeners.- Parameters:
visible- the flag.- See Also:
-
getSeparatorStroke
Returns the separator stroke.- Returns:
- The stroke (never
null). - See Also:
-
setSeparatorStroke
Sets the stroke used to draw the separator between sections and sends a change event to all registered listeners.- Parameters:
stroke- the stroke (nullnot permitted).- See Also:
-
getSeparatorPaint
Returns the separator paint.- Returns:
- The paint (never
null). - See Also:
-
setSeparatorPaint
Sets the paint used to draw the separator between sections and sends a change event to all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
-
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).
- See Also:
-
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 change event to all registered listeners.- Parameters:
percent- the percentage.- See Also:
-
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).
- See Also:
-
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 change event to all registered listeners.- Parameters:
percent- the percentage.- See Also:
-
getSectionDepth
public double getSectionDepth()Returns the depth of each section, expressed as a percentage of the plot radius.- Returns:
- The depth of each section.
- See Also:
-
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.- See Also:
-
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:
initialisein classPiePlot- Parameters:
g2- the graphics device.plotArea- the plot area (nullnot permitted).plot- the plot.index- the secondary index (nullfor primary renderer).info- collects chart rendering information for return to caller.- Returns:
- A state object (maintains state information relevant to one chart drawing).
-
drawItem
protected void drawItem(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass) Draws a single data item. -
getLabelLinkDepth
protected double getLabelLinkDepth()This method overrides the default value for cases where the ring plot is very thin. This fixes bug 2121818.- Overrides:
getLabelLinkDepthin classPiePlot- Returns:
- The label link depth, as a percentage of the plot's radius.
-
equals
Tests this plot for equality with an arbitrary object.
-