com.jrefinery.chart
Class MeterPlot

java.lang.Object
  extended by com.jrefinery.chart.Plot
      extended by com.jrefinery.chart.MeterPlot
All Implemented Interfaces:
AxisConstants, com.jrefinery.chart.event.AxisChangeListener, DatasetChangeListener
Direct Known Subclasses:
SiamMeterPlot

public class MeterPlot
extends Plot

A plot that displays a single value in the context of a range of levels (normal, warning and critical).


Field Summary
static java.lang.String CRITICAL_TEXT
          The default text for the critical level.
static java.awt.Color DEFAULT_BACKGROUND_COLOR
           
static float DEFAULT_BORDER_SIZE
           
static float DEFAULT_CIRCLE_SIZE
           
static java.awt.Font DEFAULT_LABEL_FONT
           
static int DEFAULT_METER_ANGLE
           
protected  java.awt.Color dialBorderColor
           
protected  int dialType
           
static int DIALTYPE_CHORD
           
static int DIALTYPE_CIRCLE
           
static int DIALTYPE_PIE
           
protected  boolean drawBorder
           
protected  java.awt.Font labelFont
           
protected  int labelType
          Label type (NO_LABELS, VALUE_LABELS).
protected  int meterAngle
           
protected  int meterCalcAngle
           
protected  double meterRange
           
protected  double minMeterValue
           
static int NO_LABELS
           
static java.lang.String NORMAL_TEXT
          The default text for the normal level.
protected  NumberTickUnit tickUnit
           
protected  TickUnits tickUnits
           
static int VALUE_LABELS
           
static java.lang.String WARNING_TEXT
          The default text for the warning level.
 
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
MeterPlot(MeterDataset data)
          Default constructor.
MeterPlot(MeterDataset data, java.awt.Insets insets, java.awt.Paint backgroundPaint, java.awt.Image backgroundImage, float backgroundAlpha, java.awt.Stroke outlineStroke, java.awt.Paint outlinePaint, float foregroundAlpha, int labelType, java.awt.Font labelFont)
          Constructs a new meter plot.
 
Method Summary
 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).
 java.awt.Color getCriticalColor()
           
 java.awt.Color getDialBorderColor()
           
 int getDialType()
           
 boolean getDrawBorder()
           
 java.awt.Font getLabelFont()
          Returns the label font.
 int getLabelType()
          Returns the label type.
 java.util.List getLegendItemLabels()
           
 int getMeterAngle()
           
 MeterDataset getMeterDataset()
          Returns the dataset for the plot, cast as a MeterDataset.
 java.awt.Color getNormalColor()
           
 java.lang.String getPlotType()
          Returns a short string describing the type of plot.
 java.awt.Color getWarningColor()
           
 boolean isCompatibleHorizontalAxis(Axis axis)
          Returns true if the axis is compatible with the meter plot, and false otherwise.
 boolean isCompatibleVerticalAxis(Axis axis)
          Returns true if the axis is compatible with the meter plot, and false otherwise.
 void setCriticalColor(java.awt.Color color)
           
 void setDialBorderColor(java.awt.Color color)
           
 void setDialType(int type)
           
 void setDrawBorder(boolean draw)
           
 void setLabelFont(java.awt.Font font)
          Sets the label font.
 void setLabelType(int type)
          Sets the label type.
 void setMeterAngle(int angle)
           
 void setNormalColor(java.awt.Color color)
           
 void setWarningColor(java.awt.Color color)
           
 void zoom(double percent)
          A zoom method that does nothing.
 
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, setBackgroundPaint, setDataset, setFirstSeriesIndex, setForegroundAlpha, setInsets, setOutlinePaint, setOutlineStroke, setSeriesOutlinePaint, setSeriesOutlineStroke, setSeriesOutlineStroke, setSeriesPaint, setSeriesPaint, setSeriesStroke, setSeriesStroke, setShapeFactory
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CRITICAL_TEXT

public static final java.lang.String CRITICAL_TEXT
The default text for the critical level.

See Also:
Constant Field Values

WARNING_TEXT

public static final java.lang.String WARNING_TEXT
The default text for the warning level.

See Also:
Constant Field Values

NORMAL_TEXT

public static final java.lang.String NORMAL_TEXT
The default text for the normal level.

See Also:
Constant Field Values

DEFAULT_METER_ANGLE

public static final int DEFAULT_METER_ANGLE
See Also:
Constant Field Values

DEFAULT_BORDER_SIZE

public static final float DEFAULT_BORDER_SIZE
See Also:
Constant Field Values

DEFAULT_CIRCLE_SIZE

public static final float DEFAULT_CIRCLE_SIZE
See Also:
Constant Field Values

DEFAULT_BACKGROUND_COLOR

public static final java.awt.Color DEFAULT_BACKGROUND_COLOR

DEFAULT_LABEL_FONT

public static final java.awt.Font DEFAULT_LABEL_FONT

NO_LABELS

public static final int NO_LABELS
See Also:
Constant Field Values

VALUE_LABELS

public static final int VALUE_LABELS
See Also:
Constant Field Values

labelType

protected int labelType
Label type (NO_LABELS, VALUE_LABELS).


labelFont

protected java.awt.Font labelFont

meterCalcAngle

protected int meterCalcAngle

meterRange

protected double meterRange

meterAngle

protected int meterAngle

minMeterValue

protected double minMeterValue

tickUnits

protected TickUnits tickUnits

tickUnit

protected NumberTickUnit tickUnit

DIALTYPE_PIE

public static final int DIALTYPE_PIE
See Also:
Constant Field Values

DIALTYPE_CIRCLE

public static final int DIALTYPE_CIRCLE
See Also:
Constant Field Values

DIALTYPE_CHORD

public static final int DIALTYPE_CHORD
See Also:
Constant Field Values

dialType

protected int dialType

dialBorderColor

protected java.awt.Color dialBorderColor

drawBorder

protected boolean drawBorder
Constructor Detail

MeterPlot

public MeterPlot(MeterDataset data)
Default constructor.


MeterPlot

public MeterPlot(MeterDataset data,
                 java.awt.Insets insets,
                 java.awt.Paint backgroundPaint,
                 java.awt.Image backgroundImage,
                 float backgroundAlpha,
                 java.awt.Stroke outlineStroke,
                 java.awt.Paint outlinePaint,
                 float foregroundAlpha,
                 int labelType,
                 java.awt.Font labelFont)
Constructs a new meter plot.

Parameters:
insets - The plot insets.
backgroundPaint - The background color.
backgroundImage - The background image.
backgroundAlpha - The background alpha-transparency.
outlineStroke - The outline stroke.
outlinePaint - The outline paint.
foregroundAlpha - The foreground alpha-transparency.
labelType - The label type.
labelFont - The label font.
Method Detail

getLegendItemLabels

public java.util.List getLegendItemLabels()
Specified by:
getLegendItemLabels in class Plot

getNormalColor

public java.awt.Color getNormalColor()

getWarningColor

public java.awt.Color getWarningColor()

getCriticalColor

public java.awt.Color getCriticalColor()

setWarningColor

public void setWarningColor(java.awt.Color color)

setCriticalColor

public void setCriticalColor(java.awt.Color color)

setNormalColor

public void setNormalColor(java.awt.Color color)

getMeterAngle

public int getMeterAngle()

setMeterAngle

public void setMeterAngle(int angle)

getDialType

public int getDialType()

setDialType

public void setDialType(int type)

getDialBorderColor

public java.awt.Color getDialBorderColor()

setDialBorderColor

public void setDialBorderColor(java.awt.Color color)

getDrawBorder

public boolean getDrawBorder()

setDrawBorder

public void setDrawBorder(boolean draw)

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.


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.

getMeterDataset

public MeterDataset getMeterDataset()
Returns the dataset for the plot, cast as a MeterDataset.

Provided for convenience.

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

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 short string describing the plot type.

zoom

public void zoom(double percent)
A zoom method that does nothing.

Plots are required to support the zoom operation. In the case of a pie chart, it doesn't make sense to zoom in or out, so the method is empty.

Specified by:
zoom in class Plot
Parameters:
percent - The zoom percentage.

isCompatibleHorizontalAxis

public boolean isCompatibleHorizontalAxis(Axis axis)
Returns true if the axis is compatible with the meter plot, and false otherwise. Since a meter plot requires no axes, only a null axis is compatible.

Parameters:
axis - The axis.

isCompatibleVerticalAxis

public boolean isCompatibleVerticalAxis(Axis axis)
Returns true if the axis is compatible with the meter plot, and false otherwise. Since a meter plot requires no axes, only a null axis is compatible.

Parameters:
axis - The axis.


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.