org.jfree.chart.plot

Class CompassPlot

public class CompassPlot extends Plot implements Cloneable, Serializable

A specialised plot that draws a compass to indicate a direction based on the value from a ValueDataset.
Field Summary
static FontDEFAULT_LABEL_FONT
The default label font.
protected static ResourceBundlelocalizationResources
The resourceBundle for the localization.
static intNO_LABELS
A constant for the label type.
protected doublerevolutionDistance
The count to complete one revolution.
static intVALUE_LABELS
A constant for the label type.
Constructor Summary
CompassPlot()
Default constructor.
CompassPlot(ValueDataset dataset)
Constructs a new compass plot.
Method Summary
voidaddDataset(ValueDataset dataset)
Adds a dataset to the compass.
voidaddDataset(ValueDataset dataset, MeterNeedle needle)
Adds a dataset to the compass.
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 an object for equality with this plot.
protected FontgetCompassFont(int radius)
Returns the font for the compass, adjusted for the size of the plot.
ValueDataset[]getDatasets()
Returns an array of dataset references for the plot.
booleangetDrawBorder()
Returns a flag that controls whether or not a border is drawn.
FontgetLabelFont()
Returns the label font.
intgetLabelType()
Returns the label type.
LegendItemCollectiongetLegendItems()
Returns the legend items for the plot.
StringgetPlotType()
Returns a short string describing the type of plot.
doublegetRevolutionDistance()
Gets the count to complete one revolution.
PaintgetRoseCenterPaint()
Returns the paint used to fill the inner background area of the compass.
PaintgetRoseHighlightPaint()
Returns the paint used to draw the circles, symbols and labels on the compass.
PaintgetRosePaint()
Returns the paint used to fill the outer circle of the compass.
voidsetDrawBorder(boolean status)
Sets a flag that controls whether or not a border is drawn.
voidsetLabelFont(Font font)
Sets the label font and sends a PlotChangeEvent to all registered listeners.
voidsetLabelType(int type)
Sets the label type (either NO_LABELS or VALUE_LABELS.
voidsetRevolutionDistance(double size)
Sets the count to complete one revolution.
voidsetRoseCenterPaint(Paint paint)
Sets the paint used to fill the inner background area of the compass, and sends a PlotChangeEvent to all registered listeners.
voidsetRoseHighlightPaint(Paint paint)
Sets the paint used to draw the circles, symbols and labels of the compass, and sends a PlotChangeEvent to all registered listeners.
voidsetRosePaint(Paint paint)
Sets the paint used to fill the outer circle of the compass, and sends a PlotChangeEvent to all registered listeners.
voidsetSeriesNeedle(int type)
Sets the needle type.
voidsetSeriesNeedle(int index, int type)
Sets the needle for a series.
voidsetSeriesNeedle(int index, MeterNeedle needle)
Sets the needle for a series and sends a PlotChangeEvent to all registered listeners.
voidsetSeriesOutlinePaint(int series, Paint p)
Sets the series outline paint.
voidsetSeriesOutlineStroke(int series, Stroke stroke)
Sets the series outline stroke.
voidsetSeriesPaint(int series, Paint paint)
Sets the series paint.
voidzoom(double percent)
No zooming is implemented for compass plot, so this method is empty.

Field Detail

DEFAULT_LABEL_FONT

public static final Font DEFAULT_LABEL_FONT
The default label font.

localizationResources

protected static ResourceBundle localizationResources
The resourceBundle for the localization.

NO_LABELS

public static final int NO_LABELS
A constant for the label type.

revolutionDistance

protected double revolutionDistance
The count to complete one revolution. Can be arbitrarily set For degrees (the default) it is 360, for radians this is 2*Pi, etc

VALUE_LABELS

public static final int VALUE_LABELS
A constant for the label type.

Constructor Detail

CompassPlot

public CompassPlot()
Default constructor.

CompassPlot

public CompassPlot(ValueDataset dataset)
Constructs a new compass plot.

Parameters: dataset the dataset for the plot (null permitted).

Method Detail

addDataset

public void addDataset(ValueDataset dataset)
Adds a dataset to the compass.

Parameters: dataset the new dataset (null ignored).

See Also: CompassPlot

addDataset

public void addDataset(ValueDataset dataset, MeterNeedle needle)
Adds a dataset to the compass.

Parameters: dataset the new dataset (null ignored). needle the needle (null permitted).

clone

public Object clone()
Returns a clone of the plot.

Returns: A clone.

Throws: CloneNotSupportedException this class will not throw this exception, but subclasses (if any) might.

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

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 an object for equality with this plot.

Parameters: obj the object (null permitted).

Returns: A boolean.

getCompassFont

protected Font getCompassFont(int radius)
Returns the font for the compass, adjusted for the size of the plot.

Parameters: radius the radius.

Returns: The font.

getDatasets

public ValueDataset[] getDatasets()
Returns an array of dataset references for the plot.

Returns: The dataset for the plot, cast as a ValueDataset.

See Also: addDataset

getDrawBorder

public boolean getDrawBorder()
Returns a flag that controls whether or not a border is drawn.

Returns: The flag.

See Also: CompassPlot

getLabelFont

public Font getLabelFont()
Returns the label font.

Returns: The label font.

See Also: setLabelFont

getLabelType

public int getLabelType()
Returns the label type. Defined by the constants: NO_LABELS and VALUE_LABELS.

Returns: The label type.

See Also: CompassPlot

getLegendItems

public LegendItemCollection getLegendItems()
Returns the legend items for the plot. For now, no legend is available - this method returns null.

Returns: The legend items.

getPlotType

public String getPlotType()
Returns a short string describing the type of plot.

Returns: A string describing the plot.

getRevolutionDistance

public double getRevolutionDistance()
Gets the count to complete one revolution.

Returns: The count to complete one revolution.

See Also: CompassPlot

getRoseCenterPaint

public Paint getRoseCenterPaint()
Returns the paint used to fill the inner background area of the compass.

Returns: The paint (never null).

See Also: setRoseCenterPaint

getRoseHighlightPaint

public Paint getRoseHighlightPaint()
Returns the paint used to draw the circles, symbols and labels on the compass.

Returns: The paint (never null).

See Also: setRoseHighlightPaint

getRosePaint

public Paint getRosePaint()
Returns the paint used to fill the outer circle of the compass.

Returns: The paint (never null).

See Also: setRosePaint

setDrawBorder

public void setDrawBorder(boolean status)
Sets a flag that controls whether or not a border is drawn.

Parameters: status the flag status.

See Also: getDrawBorder

setLabelFont

public void setLabelFont(Font font)
Sets the label font and sends a PlotChangeEvent to all registered listeners.

Parameters: font the new label font.

See Also: getLabelFont

setLabelType

public void setLabelType(int type)
Sets the label type (either NO_LABELS or VALUE_LABELS.

Parameters: type the type.

See Also: getLabelType

setRevolutionDistance

public void setRevolutionDistance(double size)
Sets the count to complete one revolution. Can be arbitrarily set For degrees (the default) it is 360, for radians this is 2*Pi, etc

Parameters: size the count to complete one revolution.

See Also: getRevolutionDistance

setRoseCenterPaint

public void setRoseCenterPaint(Paint paint)
Sets the paint used to fill the inner background area of the compass, and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getRoseCenterPaint

setRoseHighlightPaint

public void setRoseHighlightPaint(Paint paint)
Sets the paint used to draw the circles, symbols and labels of the compass, and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getRoseHighlightPaint

setRosePaint

public void setRosePaint(Paint paint)
Sets the paint used to fill the outer circle of the compass, and sends a PlotChangeEvent to all registered listeners.

Parameters: paint the paint (null not permitted).

See Also: getRosePaint

setSeriesNeedle

public void setSeriesNeedle(int type)
Sets the needle type.

Parameters: type the type.

See Also: CompassPlot

setSeriesNeedle

public void setSeriesNeedle(int index, int type)
Sets the needle for a series. The needle type is one of the following:

Parameters: index the series index. type the needle type.

See Also: CompassPlot

setSeriesNeedle

public void setSeriesNeedle(int index, MeterNeedle needle)
Sets the needle for a series and sends a PlotChangeEvent to all registered listeners.

Parameters: index the series index. needle the needle.

setSeriesOutlinePaint

public void setSeriesOutlinePaint(int series, Paint p)
Sets the series outline paint.

Parameters: series the series index. p the paint.

See Also: CompassPlot

setSeriesOutlineStroke

public void setSeriesOutlineStroke(int series, Stroke stroke)
Sets the series outline stroke.

Parameters: series the series index. stroke the stroke.

See Also: CompassPlot

setSeriesPaint

public void setSeriesPaint(int series, Paint paint)
Sets the series paint.

Parameters: series the series index. paint the paint.

See Also: CompassPlot

zoom

public void zoom(double percent)
No zooming is implemented for compass plot, so this method is empty.

Parameters: percent the zoom amount.