com.jrefinery.chart
Class CompassPlot

java.lang.Object
  extended by com.jrefinery.chart.Plot
      extended by com.jrefinery.chart.CompassPlot
All Implemented Interfaces:
AxisConstants, com.jrefinery.chart.event.AxisChangeListener, DatasetChangeListener, java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
SiamCompassPlot

public class CompassPlot
extends Plot
implements java.lang.Cloneable, java.io.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
static java.awt.Font DEFAULT_LABEL_FONT
          The default label font.
protected static java.util.ResourceBundle localizationResources
          The resourceBundle for the localization.
static int NO_LABELS
          A constant for the label type.
static int VALUE_LABELS
          A constant for the label type.
 
Fields inherited from class com.jrefinery.chart.Plot
backgroundAlpha, backgroundImage, backgroundPaint, dataset, DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, firstSeriesIndex, foregroundAlpha, insets, listeners, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, outlinePaint, outlineStroke, seriesOutlinePaint, seriesOutlineStroke, seriesPaint, seriesStroke, shapeFactory, ZERO
 
Fields inherited from interface com.jrefinery.chart.AxisConstants
DEFAULT_AXIS_LABEL_FONT, DEFAULT_AXIS_LABEL_INSETS, DEFAULT_AXIS_LABEL_PAINT, DEFAULT_TICK_LABEL_FONT, DEFAULT_TICK_LABEL_INSETS, DEFAULT_TICK_LABEL_PAINT, DEFAULT_TICK_STROKE
 
Constructor Summary
CompassPlot()
          Default constructor.
CompassPlot(ValueDataset dataset)
          Constructs a new compass plot.
 
Method Summary
 void addData(ValueDataset data)
          Adds a dataset to the compass.
 void addData(ValueDataset data, MeterNeedle needle)
          Adds a dataset to the compass.
 java.lang.Object clone()
          Returns a clone of the annotation.
 void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, ChartRenderingInfo info)
          Draws the plot on a Java 2D graphics device (such as the screen or a printer).
 void drawBackground(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea)
           
 void drawOutline(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea)
           
 boolean equals(java.lang.Object object)
          Tests an object for equality with this plot.
protected  java.awt.Font getCompassFont(int radius)
          Returns the font for the compass.
 ValueDataset[] getData()
          Returns the dataset.
 boolean getDrawBorder()
          Returns a flag that controls whether or not a border is drawn.
 java.awt.Font getLabelFont()
          Returns the label font.
 int getLabelType()
          Returns the label type.
 java.util.List getLegendItemLabels()
          Deprecated. use getLegendItems().
 LegendItemCollection getLegendItems()
          Returns the legend items for the plot.
 java.lang.String getPlotType()
          Returns a short string describing the type of plot.
 void setBackgroundPaint(java.awt.Paint paint)
          Sets the background color of the plot area, and notifies registered listeners that the plot has been modified.
 void setDrawBorder(boolean status)
          Sets a flag that controls whether or not a border is drawn.
 void setHighlightPaint(java.awt.Paint paint)
           
 void setLabelFont(java.awt.Font font)
          Sets the label font.
 void setLabelType(int type)
          Sets the label type.
 void setOutlinePaint(java.awt.Paint paint)
          Sets the color of the outline of the plot area, and notifies registered listeners that the Plot has been modified.
 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.
 void setSeriesOutlinePaint(int series, java.awt.Paint p)
          Sets the series outline paint.
 void setSeriesOutlineStroke(int series, java.awt.Stroke stroke)
          Sets the series outline stroke.
 void setSeriesPaint(int series, java.awt.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 com.jrefinery.chart.Plot
addChangeListener, axisChanged, datasetChanged, drawOutlineAndBackground, getBackgroundAlpha, getBackgroundPaint, getDataset, getFirstSeriesIndex, getForegroundAlpha, getInsets, getOutlinePaint, getOutlineStroke, getSeriesOutlinePaint, getSeriesOutlineStroke, getSeriesPaint, getSeriesStroke, getShape, getShape, getShapeFactory, handleClick, isSubplot, notifyListeners, removeChangeListener, setBackgroundAlpha, setBackgroundImage, setDataset, setFirstSeriesIndex, setForegroundAlpha, setInsets, setOutlineStroke, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesPaint, setSeriesStroke, setSeriesStroke, setShapeFactory
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_LABEL_FONT

public static final java.awt.Font DEFAULT_LABEL_FONT
The default label font.


NO_LABELS

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

See Also:
Constant Field Values

VALUE_LABELS

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

See Also:
Constant Field Values

localizationResources

protected static java.util.ResourceBundle localizationResources
The resourceBundle for the localization.

Constructor Detail

CompassPlot

public CompassPlot()
Default constructor.


CompassPlot

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

Parameters:
dataset - the dataset for the plot.
Method Detail

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

public java.awt.Font getLabelFont()
Returns the label font.

Returns:
the label font.

setLabelFont

public void setLabelFont(java.awt.Font font)
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

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

Overrides:
setSeriesPaint in class Plot
Parameters:
series - the series index.
paint - the paint.

setSeriesOutlinePaint

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

Parameters:
series - the series index.
p - the paint.

setSeriesOutlineStroke

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

Overrides:
setSeriesOutlineStroke in class Plot
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

public void setSeriesNeedle(int index,
                            MeterNeedle needle)
Sets the needle for a series.

Parameters:
index - the series index.
needle - the needle.

getData

public ValueDataset[] getData()
Returns the dataset.

Provided for convenience.

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

addData

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

Parameters:
data - the new dataset.

addData

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

Parameters:
data - the new dataset.
needle - the needle.

draw

public void draw(java.awt.Graphics2D g2,
                 java.awt.geom.Rectangle2D plotArea,
                 ChartRenderingInfo info)
Draws the plot on a Java 2D graphics device (such as the screen or a printer).

Specified by:
draw in class Plot
Parameters:
g2 - the graphics device.
plotArea - the area within which the plot should be drawn.
info - collects info about the drawing.

getPlotType

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

Specified by:
getPlotType in class Plot
Returns:
a string describing the plot.

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.

zoom

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

Specified by:
zoom in class Plot
Parameters:
percent - the zoom amount.

getCompassFont

protected java.awt.Font getCompassFont(int radius)
Returns the font for the compass.

Parameters:
radius - the radius.
Returns:
the font.

getLegendItemLabels

public java.util.List getLegendItemLabels()
Deprecated. use getLegendItems().

Returns a list of legend item labels.

Specified by:
getLegendItemLabels in class Plot
Returns:
a list of legend item labels.

equals

public boolean equals(java.lang.Object object)
Tests an object for equality with this plot.

Overrides:
equals in class java.lang.Object
Parameters:
object - the object.
Returns:
A boolean.

clone

public java.lang.Object clone()
                       throws java.lang.CloneNotSupportedException
Returns a clone of the annotation.

Overrides:
clone in class java.lang.Object
Returns:
A clone.
Throws:
java.lang.CloneNotSupportedException - this class will not throw this exception, but subclasses (if any) might.

drawBackground

public void drawBackground(java.awt.Graphics2D g2,
                           java.awt.geom.Rectangle2D plotArea)

drawOutline

public void drawOutline(java.awt.Graphics2D g2,
                        java.awt.geom.Rectangle2D plotArea)

setBackgroundPaint

public void setBackgroundPaint(java.awt.Paint paint)
Description copied from class: Plot
Sets the background color of the plot area, and notifies registered listeners that the plot has been modified.

Overrides:
setBackgroundPaint in class Plot
Parameters:
paint - The new background color (null permitted).

setHighlightPaint

public void setHighlightPaint(java.awt.Paint paint)

setOutlinePaint

public void setOutlinePaint(java.awt.Paint paint)
Description copied from class: Plot
Sets the color of the outline of the plot area, and notifies registered listeners that the Plot has been modified.

Overrides:
setOutlinePaint in class Plot
Parameters:
paint - The new outline paint (null permitted).


Copyright © 2003 MBARI.

The Monterey Bay Aquarium Research Institute (MBARI) provides this documentation and code "as is", with no warranty, express or implied, of its quality or consistency. It is provided without support and without obligation on the part of MBARI to assist in its use, correction, modification, or enhancement.