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
,AnnotationChangeListener
,AxisChangeListener
,MarkerChangeListener
,LegendItemSource
,PublicCloneable
,DatasetChangeListener
A specialised plot that draws a compass to indicate a direction based on the
value from a
ValueDataset
.- See Also:
-
Field Summary
Modifier and TypeFieldDescriptionstatic final Font
The default label font.protected static ResourceBundle
The resourceBundle for the localization.static final int
A constant for the label type.protected double
The count to complete one revolution.static final int
A 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_LEGEND_ITEM_BOX, DEFAULT_LEGEND_ITEM_CIRCLE, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO
-
Constructor Summary
ConstructorDescriptionDefault constructor.CompassPlot
(ValueDataset dataset) Constructs a new compass plot. -
Method Summary
Modifier and TypeMethodDescriptionvoid
addDataset
(ValueDataset dataset) Adds a dataset to the compass.void
addDataset
(ValueDataset dataset, MeterNeedle needle) Adds a dataset to the compass.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
Tests an object for equality with this plot.protected Font
getCompassFont
(int radius) Returns the font for the compass, adjusted for the size of the plot.Returns an array of dataset references for the plot.boolean
Returns a flag that controls whether or not a border is drawn.Returns the label font.int
Returns the label type.Returns the legend items for the plot.Returns a short string describing the type of plot.double
Gets the count to complete one revolution.Returns the paint used to fill the inner background area of the compass.Returns the paint used to draw the circles, symbols and labels on the compass.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 aPlotChangeEvent
to all registered listeners.void
setLabelType
(int type) Sets the label type (eitherNO_LABELS
orVALUE_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 aPlotChangeEvent
to all registered listeners.void
setRoseHighlightPaint
(Paint paint) Sets the paint used to draw the circles, symbols and labels of the compass, and sends aPlotChangeEvent
to all registered listeners.void
setRosePaint
(Paint paint) Sets the paint used to fill the outer circle of the compass, and sends aPlotChangeEvent
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 aPlotChangeEvent
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.Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, annotationChanged, axisChanged, canEqual, 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, hashCode, 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
-
Field Details
-
DEFAULT_LABEL_FONT
The default label font. -
NO_LABELS
A constant for the label type.- See Also:
-
VALUE_LABELS
A constant for the label type.- See Also:
-
localizationResources
The resourceBundle for the localization. -
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
-
-
Constructor Details
-
CompassPlot
public CompassPlot()Default constructor. -
CompassPlot
Constructs a new compass plot.- Parameters:
dataset
- the dataset for the plot (null
permitted).
-
-
Method Details
-
getLabelType
Returns the label type. Defined by the constants:NO_LABELS
andVALUE_LABELS
.- Returns:
- The label type.
- See Also:
-
setLabelType
Sets the label type (eitherNO_LABELS
orVALUE_LABELS
.- Parameters:
type
- the type.- See Also:
-
getLabelFont
Returns the label font.- Returns:
- The label font.
- See Also:
-
setLabelFont
Sets the label font and sends aPlotChangeEvent
to all registered listeners.- Parameters:
font
- the new label font.- See Also:
-
getRosePaint
Returns the paint used to fill the outer circle of the compass.- Returns:
- The paint (never
null
). - See Also:
-
setRosePaint
Sets the paint used to fill the outer circle of the compass, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getRoseCenterPaint
Returns the paint used to fill the inner background area of the compass.- Returns:
- The paint (never
null
). - See Also:
-
setRoseCenterPaint
Sets the paint used to fill the inner background area of the compass, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getRoseHighlightPaint
Returns the paint used to draw the circles, symbols and labels on the compass.- Returns:
- The paint (never
null
). - See Also:
-
setRoseHighlightPaint
Sets the paint used to draw the circles, symbols and labels of the compass, and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
-
getDrawBorder
Returns a flag that controls whether or not a border is drawn.- Returns:
- The flag.
- See Also:
-
setDrawBorder
Sets a flag that controls whether or not a border is drawn.- Parameters:
status
- the flag status.- See Also:
-
setSeriesPaint
Sets the series paint.- Parameters:
series
- the series index.paint
- the paint.- See Also:
-
setSeriesOutlinePaint
Sets the series outline paint.- Parameters:
series
- the series index.p
- the paint.- See Also:
-
setSeriesOutlineStroke
Sets the series outline stroke.- Parameters:
series
- the series index.stroke
- the stroke.- See Also:
-
setSeriesNeedle
Sets the needle type.- Parameters:
type
- the type.- See Also:
-
setSeriesNeedle
Sets the needle for a series. The needle type is one of the following:- 0 =
ArrowNeedle
; - 1 =
LineNeedle
; - 2 =
LongNeedle
; - 3 =
PinNeedle
; - 4 =
PlumNeedle
; - 5 =
PointerNeedle
; - 6 =
ShipNeedle
; - 7 =
WindNeedle
; - 8 =
ArrowNeedle
; - 9 =
MiddlePinNeedle
;
- Parameters:
index
- the series index.type
- the needle type.- See Also:
- 0 =
-
setSeriesNeedle
Sets the needle for a series and sends aPlotChangeEvent
to all registered listeners.- Parameters:
index
- the series index.needle
- the needle.
-
getDatasets
Returns an array of dataset references for the plot.- Returns:
- The dataset for the plot, cast as a ValueDataset.
- See Also:
-
addDataset
Adds a dataset to the compass.- Parameters:
dataset
- the new dataset (null
ignored).- See Also:
-
addDataset
Adds a dataset to the compass.- Parameters:
dataset
- the new dataset (null
ignored).needle
- the needle (null
permitted).
-
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). -
getPlotType
Returns a short string describing the type of plot.- Specified by:
getPlotType
in 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.- Specified by:
getLegendItems
in interfaceLegendItemSource
- Overrides:
getLegendItems
in classPlot
- Returns:
- The legend items.
-
zoom
No zooming is implemented for compass plot, so this method is empty. -
getCompassFont
Returns the font for the compass, adjusted for the size of the plot.- Parameters:
radius
- the radius.- Returns:
- The font.
-
equals
Tests an object for equality with this plot. -
clone
Returns a clone of the plot.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classPlot
- Returns:
- A clone.
- Throws:
CloneNotSupportedException
- this class will not throw this exception, but subclasses (if any) might.
-
setRevolutionDistance
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
Gets the count to complete one revolution.- Returns:
- The count to complete one revolution.
- See Also:
-