Package org.jfree.chart.plot
Class CompassPlot
java.lang.Object
org.jfree.chart.plot.Plot
org.jfree.chart.plot.CompassPlot
- All Implemented Interfaces:
Serializable,Cloneable,EventListener,AxisChangeListener,DatasetChangeListener
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.- Author:
- Bryan Scott
- See Also:
- Serialized Form
-
Field Summary
Fields Modifier and Type Field Description static FontDEFAULT_LABEL_FONTThe default label font.static intNO_LABELSA constant for the label type.static intVALUE_LABELSA constant for the label type.Fields inherited from class org.jfree.chart.plot.Plot
DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO -
Constructor Summary
Constructors Constructor Description CompassPlot()Default constructor.CompassPlot(ValueDataset dataset)Constructs a new compass plot. -
Method Summary
Modifier and Type Method Description voidaddData(ValueDataset data)Adds a dataset to the compass.voidaddData(ValueDataset data, MeterNeedle needle)Adds a dataset to the compass.Objectclone()Returns a clone of the annotation.voiddraw(Graphics2D g2, Rectangle2D plotArea, PlotState parentState, PlotRenderingInfo info)Draws the plot on a Java 2D graphics device (such as the screen or a printer).booleanequals(Object object)Tests an object for equality with this plot.ValueDataset[]getData()Returns the dataset.booleangetDrawBorder()Returns a flag that controls whether or not a border is drawn.FontgetLabelFont()Returns the label font.intgetLabelType()Returns the label type.ListgetLegendItemLabels()Deprecated.use getLegendItems().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.voidsetDrawBorder(boolean status)Sets a flag that controls whether or not a border is drawn.voidsetLabelFont(Font font)Sets the label font.voidsetLabelType(int type)Sets the label type.voidsetRevolutionDistance(double size)Sets the count to complete one revolution.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.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.Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, axisChanged, datasetChanged, draw, drawBackground, drawOutline, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundPaint, getDataAreaRatio, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRootPlot, handleClick, isPlotShowing, isSubplot, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundPaint, setDataAreaRatio, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setOutlinePaint, setOutlineStroke, setParent, setPlotShowing
-
Field Details
-
DEFAULT_LABEL_FONT
The default label font. -
NO_LABELS
public static final int NO_LABELSA constant for the label type.- See Also:
- Constant Field Values
-
VALUE_LABELS
public static final int VALUE_LABELSA constant for the label type.- See Also:
- Constant Field Values
-
-
Constructor Details
-
CompassPlot
public CompassPlot()Default constructor. -
CompassPlot
Constructs a new compass plot.- Parameters:
dataset- the dataset for the plot.
-
-
Method Details
-
getLabelType
public int getLabelType()Returns the label type. Defined by the constants: NO_LABELS, VALUE_LABELS.- Returns:
- The label type.
-
setLabelType
public void setLabelType(int type)Sets the label type.Valid types are defined by the following constants: NO_LABELS, VALUE_LABELS.
- Parameters:
type- the type.
-
getLabelFont
Returns the label font.- Returns:
- the label font.
-
setLabelFont
Sets the label font.Notifies registered listeners that the plot has been changed.
- Parameters:
font- the new label font.
-
getDrawBorder
public boolean getDrawBorder()Returns a flag that controls whether or not a border is drawn.- Returns:
- the flag.
-
setDrawBorder
public void setDrawBorder(boolean status)Sets a flag that controls whether or not a border is drawn.- Parameters:
status- the flag status.
-
setSeriesPaint
Sets the series paint.- Parameters:
series- the series index.paint- the paint.
-
setSeriesOutlinePaint
Sets the series outline paint.- Parameters:
series- the series index.p- the paint.
-
setSeriesOutlineStroke
Sets the series outline stroke.- Parameters:
series- the series index.stroke- the stroke.
-
setSeriesNeedle
public void setSeriesNeedle(int type)Sets the needle type.- Parameters:
type- the type.
-
setSeriesNeedle
public void setSeriesNeedle(int index, int type)Sets the needle for a series.- Parameters:
index- the series index.type- the needle type.
-
setSeriesNeedle
Sets the needle for a series.- Parameters:
index- the series index.needle- the needle.
-
getData
Returns the dataset.Provided for convenience.
- Returns:
- The dataset for the plot, cast as a ValueDataset.
-
addData
Adds a dataset to the compass.- Parameters:
data- the new dataset.
-
addData
Adds a dataset to the compass.- Parameters:
data- the new dataset.needle- the needle.
-
draw
public void draw(Graphics2D g2, Rectangle2D plotArea, PlotState parentState, PlotRenderingInfo info)Draws the plot on a Java 2D graphics device (such as the screen or a printer). -
getPlotType
Returns a short string describing the type of plot.- Specified by:
getPlotTypein classPlot- Returns:
- a string describing the plot.
-
getLegendItems
Returns the legend items for the plot. For now, no legend is available - this method returns null.- Overrides:
getLegendItemsin classPlot- Returns:
- the legend items.
-
zoom
public void zoom(double percent)No zooming is implemented for compass plot, so this method is empty. -
getLegendItemLabels
Deprecated.use getLegendItems().Returns a list of legend item labels.- Returns:
- a list of legend item labels.
-
equals
Tests an object for equality with this plot. -
clone
Returns a clone of the annotation.- Overrides:
clonein classPlot- Returns:
- A clone.
- Throws:
CloneNotSupportedException- this class will not throw this exception, but subclasses (if any) might.
-
setRevolutionDistance
public void setRevolutionDistance(double size)Sets the count to complete one revolution. Can be arbitaly set For degrees (the default) it is 360, for radians this is 2*Pi, etc- Parameters:
size- the count to complete one revolution.
-
getRevolutionDistance
public double getRevolutionDistance()Gets the count to complete one revolution.- Returns:
- the count to complete one revolution
-