public class

CompassPlot

extends Plot
implements Serializable Cloneable
java.lang.Object
   ↳ org.jfree.chart.plot.Plot
     ↳ org.jfree.chart.plot.CompassPlot

Class Overview

A specialised plot that draws a compass to indicate a direction based on the value from a ValueDataset.

Summary

Constants
int NO_LABELS A constant for the label type.
int VALUE_LABELS A constant for the label type.
[Expand]
Inherited Constants
From class org.jfree.chart.plot.Plot
Fields
public static final Font DEFAULT_LABEL_FONT The default label font.
protected static ResourceBundle localizationResources The resourceBundle for the localization.
protected double revolutionDistance The count to complete one revolution.
[Expand]
Inherited Fields
From class org.jfree.chart.plot.Plot
Public Constructors
CompassPlot()
Default constructor.
CompassPlot(ValueDataset dataset)
Constructs a new compass plot.
Public Methods
void addDataset(ValueDataset dataset)
Adds a dataset to the compass.
void addDataset(ValueDataset dataset, MeterNeedle needle)
Adds a dataset to the compass.
Object clone()
Returns a clone of the plot.
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 an object for equality with this plot.
ValueDataset[] getDatasets()
Returns an array of dataset references for the plot.
boolean getDrawBorder()
Returns a flag that controls whether or not a border is drawn.
Font getLabelFont()
Returns the label font.
int getLabelType()
Returns the label type.
LegendItemCollection getLegendItems()
Returns the legend items for the plot.
String getPlotType()
Returns a short string describing the type of plot.
double getRevolutionDistance()
Gets the count to complete one revolution.
Paint getRoseCenterPaint()
Returns the paint used to fill the inner background area of the compass.
Paint getRoseHighlightPaint()
Returns the paint used to draw the circles, symbols and labels on the compass.
Paint getRosePaint()
Returns the paint used to fill the outer circle of the compass.
void setDrawBorder(boolean status)
Sets a flag that controls whether or not a border is drawn.
void setLabelFont(Font font)
Sets the label font and sends a PlotChangeEvent to all registered listeners.
void setLabelType(int type)
Sets the label type (either NO_LABELS or VALUE_LABELS.
void setRevolutionDistance(double size)
Sets the count to complete one revolution.
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.
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.
void setRosePaint(Paint paint)
Sets the paint used to fill the outer circle of the compass, and sends a PlotChangeEvent to all registered listeners.
void setSeriesNeedle(int type)
Sets the needle type.
void setSeriesNeedle(int index, int type)
Sets the needle for a series.
void setSeriesNeedle(int index, MeterNeedle needle)
Sets the needle for a series and sends a PlotChangeEvent to all registered listeners.
void setSeriesOutlinePaint(int series, Paint p)
Sets the series outline paint.
void setSeriesOutlineStroke(int series, Stroke stroke)
Sets the series outline stroke.
void setSeriesPaint(int series, Paint paint)
Sets the series paint.
void zoom(double percent)
No zooming is implemented for compass plot, so this method is empty.
Protected Methods
Font getCompassFont(int radius)
Returns the font for the compass, adjusted for the size of the plot.
[Expand]
Inherited Methods
From class org.jfree.chart.plot.Plot
From class java.lang.Object
From interface org.jfree.chart.LegendItemSource
From interface org.jfree.chart.event.AxisChangeListener
From interface org.jfree.chart.event.MarkerChangeListener
From interface org.jfree.data.general.DatasetChangeListener

Constants

public static final int NO_LABELS

A constant for the label type.

Constant Value: 0 (0x00000000)

public static final int VALUE_LABELS

A constant for the label type.

Constant Value: 1 (0x00000001)

Fields

public static final Font DEFAULT_LABEL_FONT

The default label font.

protected static ResourceBundle localizationResources

The resourceBundle for the localization.

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

Public Constructors

public CompassPlot ()

Default constructor.

public CompassPlot (ValueDataset dataset)

Constructs a new compass plot.

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

Public Methods

public void addDataset (ValueDataset dataset)

Adds a dataset to the compass.

Parameters
dataset the new dataset (null ignored).

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

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.

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.

public boolean equals (Object obj)

Tests an object for equality with this plot.

Parameters
obj the object (null permitted).
Returns
  • A boolean.

public ValueDataset[] getDatasets ()

Returns an array of dataset references for the plot.

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

public boolean getDrawBorder ()

Returns a flag that controls whether or not a border is drawn.

Returns
  • The flag.

public Font getLabelFont ()

Returns the label font.

Returns
  • The label font.

public int getLabelType ()

Returns the label type. Defined by the constants: NO_LABELS and VALUE_LABELS.

Returns
  • The label type.

public LegendItemCollection getLegendItems ()

Returns the legend items for the plot. For now, no legend is available - this method returns null.

Returns
  • The legend items.

public String getPlotType ()

Returns a short string describing the type of plot.

Returns
  • A string describing the plot.

public double getRevolutionDistance ()

Gets the count to complete one revolution.

Returns
  • The count to complete one revolution.

public Paint getRoseCenterPaint ()

Returns the paint used to fill the inner background area of the compass.

Returns
  • The paint (never null).

public Paint getRoseHighlightPaint ()

Returns the paint used to draw the circles, symbols and labels on the compass.

Returns
  • The paint (never null).

public Paint getRosePaint ()

Returns the paint used to fill the outer circle of the compass.

Returns
  • The paint (never null).

public void setDrawBorder (boolean status)

Sets a flag that controls whether or not a border is drawn.

Parameters
status the flag status.
See Also

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

public void setLabelType (int type)

Sets the label type (either NO_LABELS or VALUE_LABELS.

Parameters
type the type.
See Also

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.

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

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

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

public void setSeriesNeedle (int type)

Sets the needle type.

Parameters
type the type.

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.

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.

public void setSeriesOutlinePaint (int series, Paint p)

Sets the series outline paint.

Parameters
series the series index.
p the paint.

public void setSeriesOutlineStroke (int series, Stroke stroke)

Sets the series outline stroke.

Parameters
series the series index.
stroke the stroke.

public void setSeriesPaint (int series, Paint paint)

Sets the series paint.

Parameters
series the series index.
paint the paint.

public void zoom (double percent)

No zooming is implemented for compass plot, so this method is empty.

Parameters
percent the zoom amount.

Protected Methods

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.