org.jfree.chart.plot

Class RingPlot

public class RingPlot extends PiePlot implements Cloneable, Serializable

A customised pie plot that leaves a hole in the middle.
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 voiddrawItem(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass)
Draws a single data item.
booleanequals(Object obj)
Tests this plot for equality with an arbitrary object.
doublegetInnerSeparatorExtension()
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.
protected doublegetLabelLinkDepth()
This method overrides the default value for cases where the ring plot is very thin.
doublegetOuterSeparatorExtension()
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.
doublegetSectionDepth()
Returns the depth of each section, expressed as a percentage of the plot radius.
PaintgetSeparatorPaint()
Returns the separator paint.
booleangetSeparatorsVisible()
Returns a flag that indicates whether or not separators are drawn between the sections in the chart.
StrokegetSeparatorStroke()
Returns the separator stroke.
PiePlotStateinitialise(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).
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 PlotChangeEvent 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 PlotChangeEvent 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 PlotChangeEvent 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 PlotChangeEvent to all registered listeners.
voidsetSeparatorStroke(Stroke stroke)
Sets the stroke used to draw the separator between sections and sends a PlotChangeEvent to all registered listeners.

Constructor Detail

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 Detail

drawItem

protected void drawItem(Graphics2D g2, int section, Rectangle2D dataArea, PiePlotState state, int currentPass)
Draws a single data item.

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.

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).

See Also: RingPlot

getLabelLinkDepth

protected double getLabelLinkDepth()
This method overrides the default value for cases where the ring plot is very thin. This fixes bug 2121818.

Returns: The label link depth, as a percentage of the plot's radius.

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: RingPlot

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

See Also: RingPlot

getSeparatorPaint

public Paint getSeparatorPaint()
Returns the separator paint.

Returns: The paint (never null).

See Also: setSeparatorPaint

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: RingPlot

getSeparatorStroke

public Stroke getSeparatorStroke()
Returns the separator stroke.

Returns: The stroke (never null).

See Also: setSeparatorStroke

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.

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.

See Also: getInnerSeparatorExtension RingPlot

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.

See Also: getOuterSeparatorExtension

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

See Also: getSectionDepth

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).

See Also: getSeparatorPaint

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.

See Also: getSeparatorsVisible

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).

See Also: getSeparatorStroke

Copyright © 2000-2009 by Object Refinery Limited. All Rights Reserved.