## org.jfree.chart.plot
Class MeterPlot

    java.lang.Object
      org.jfree.chart.plot.Plot
          org.jfree.chart.plot.MeterPlot

All Implemented Interfaces:
  AxisChangeListener, java.lang.Cloneable, DatasetChangeListener, java.util.EventListener, java.io.Serializable

public class MeterPlot
extends Plot
implements java.io.Serializable, java.lang.Cloneable

A plot that displays a single value in the context of several ranges ('normal', 'warning' and 'critical').

See Also:
  Serialized Form

Field Summary
`static int` `CRITICAL_DATA_RANGE` Constant to indicate the critical data range.
`static java.lang.String` `CRITICAL_TEXT` The default text for the critical level.
`static java.awt.Paint` `DEFAULT_BACKGROUND_PAINT` The default background color.
`static float` `DEFAULT_BORDER_SIZE` The default border size.
`static float` `DEFAULT_CIRCLE_SIZE` The default circle size.
`static java.awt.Font` `DEFAULT_LABEL_FONT` The default label font.
`static int` `DEFAULT_METER_ANGLE` The default meter angle.
`static int` `DIALTYPE_CHORD` Constant for meter type 'chord'.
`static int` `DIALTYPE_CIRCLE` Constant for meter type 'circle'.
`static int` `DIALTYPE_PIE` Constant for meter type 'pie'.
`static int` `FULL_DATA_RANGE` Constant to indicate the full data range.
`protected static java.util.ResourceBundle` `localizationResources` The resourceBundle for the localization.
`static int` `NO_LABELS` Constant for the label type.
`static int` `NORMAL_DATA_RANGE` Constant to indicate the normal data range.
`static java.lang.String` `NORMAL_TEXT` The default text for the normal level.
`static int` `VALUE_LABELS` Constant for the label type.
`static int` `WARNING_DATA_RANGE` Constant to indicate the warning data range.
`static java.lang.String` `WARNING_TEXT` The default text for the warning level.

Fields inherited from class org.jfree.chart.plot.Plot
`DEFAULT_BACKGROUND_ALPHA, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO`

Constructor Summary
`MeterPlot()` Creates a new plot with no dataset.
`MeterPlot(ValueDataset dataset)` Creates a new plot that displays the value in the supplied dataset.

Method Summary
`java.lang.Object` `clone()` Correct cloning support, management of deeper copies and listeners
`void` `draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, PlotState parentState, PlotRenderingInfo info)` Draws the plot on a Java 2D graphics device (such as the screen or a printer).
`protected void` `drawArc(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, double minValue, double maxValue, java.awt.Paint paint)` Draws an arc.
`protected void` `drawArc(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, double minValue, double maxValue, java.awt.Paint paint, int outlineType)` Draws an arc.
`protected void` `drawArcFor(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D meterArea, ValueDataset data, int type)` Draws a colored range (arc) for one level.
`protected void` `drawTick(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D meterArea, double value)` Draws a tick.
`protected void` `drawTick(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D meterArea, double value, boolean label, java.awt.Paint color)` Draws a tick.
`protected void` `drawTick(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D meterArea, double value, boolean label, java.awt.Paint labelPaint, boolean curValue, java.lang.String units)` Draws a tick on the chart (also handles a special case [curValue=true] that draws the value in the middle of the dial).
`protected void` `drawTicks(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D meterArea, double minValue, double maxValue)` Draws the ticks.
`boolean` `equals(java.lang.Object object)` Tests the plot for equality with an arbitrary object.
`java.awt.Paint` `getCriticalPaint()` Returns the paint used to display the 'critical' range.
`Range` `getCriticalRange()` Returns the critical range for the dial.
`ValueDataset` `getDataset()` Returns the primary dataset for the plot.
`java.awt.Paint` `getDialBackgroundPaint()` Returns the paint for the dial background.
`java.awt.Paint` `getDialOutlinePaint()` Returns the dial outline paint.
`DialShape` `getDialShape()` Returns the dial shape.
`int` `getDialType()` Deprecated. Use getDialShape().
`boolean` `getDrawBorder()` Returns a flag that controls whether or not a rectangular border is drawn around the plot area.
`java.util.List` `getLegendItemLabels()` Deprecated. use getLegendItems().
`LegendItemCollection` `getLegendItems()` Returns null.
`int` `getMeterAngle()` Returns the meter angle.
`java.awt.Paint` `getNeedlePaint()` Returns the paint for the needle.
`java.awt.Paint` `getNormalPaint()` Returns the paint for the 'normal' level.
`Range` `getNormalRange()` Returns the normal range for the dial.
`java.lang.String` `getPlotType()` Returns a short string describing the type of plot.
`Range` `getRange()` Returns the overall range for the dial.
`java.awt.Font` `getTickLabelFont()` Returns the tick label font.
`java.text.NumberFormat` `getTickLabelFormat()` Returns the tick label format.
`int` `getTickLabelType()` Returns the tick label type.
`java.lang.String` `getUnits()` Returns the units for the dial.
`java.awt.Font` `getValueFont()` Returns the font for the value label.
`java.awt.Paint` `getValuePaint()` Returns the paint for the value label.
`java.awt.Paint` `getWarningPaint()` Returns the paint used to display the 'warning' range.
`Range` `getWarningRange()` Returns the warning range for the dial.
`void` `setCriticalPaint(java.awt.Paint paint)` Sets the paint used to display the 'critical' range.
`void` `setCriticalRange(Range range)` Sets the critical range for the dial.
`void` `setDataset(ValueDataset dataset)` Sets the dataset for the plot, replacing the existing dataset if there is one.
`void` `setDialBackgroundPaint(java.awt.Paint paint)` Sets the paint used to fill the dial background.
`void` `setDialOutlinePaint(java.awt.Paint paint)` Sets the dial outline paint.
`void` `setDialShape(DialShape shape)` Sets the dial shape.
`void` `setDialType(int type)` Deprecated. Use setDialShape(...).
`void` `setDrawBorder(boolean draw)` Sets the flag that controls whether or not a rectangular border is drawn around the plot area.
`void` `setMeterAngle(int angle)` Sets the range through which the dial's needle is free to rotate.
`void` `setNeedlePaint(java.awt.Paint paint)` Sets the paint used to display the needle.
`void` `setNormalPaint(java.awt.Paint paint)` Sets the paint used to display the 'normal' range.
`void` `setNormalRange(Range range)` Sets the normal range for the dial.
`void` `setRange(Range range)` Sets the overall range for the dial.
`void` `setTickLabelFont(java.awt.Font font)` Sets the tick label font and sends a `PlotChangeEvent` to all registered listeners.
`void` `setTickLabelFormat(java.text.NumberFormat format)` Sets the format for the tick labels and sends a `PlotChangeEvent` to all registered listeners.
`void` `setTickLabelType(int type)` Sets the tick label type.
`void` `setUnits(java.lang.String units)` Sets the units for the dial.
`void` `setValueFont(java.awt.Font font)` Sets the font used to display the value label.
`void` `setValuePaint(java.awt.Paint paint)` Sets the paint used to display the value label.
`void` `setWarningPaint(java.awt.Paint paint)` Sets the paint used to display the 'warning' range.
`void` `setWarningRange(Range range)` Sets the warning range for the dial.
`void` `zoom(double percent)` A zoom method that does nothing.

Methods inherited from class org.jfree.chart.plot.Plot

`addChangeListener, axisChanged, datasetChanged, draw, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fillBackground, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundPaint, getDataAreaRatio, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, handleClick, isSubplot, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundPaint, setDataAreaRatio, setDatasetGroup, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setOutlinePaint, setOutlineStroke, setParent`

Methods inherited from class java.lang.Object
`finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NORMAL_DATA_RANGE

    public static final int NORMAL_DATA_RANGE

  Constant to indicate the normal data range.

  See Also:
    Constant Field Values

### WARNING_DATA_RANGE

    public static final int WARNING_DATA_RANGE

  Constant to indicate the warning data range.

  See Also:
    Constant Field Values

### CRITICAL_DATA_RANGE

    public static final int CRITICAL_DATA_RANGE

  Constant to indicate the critical data range.

  See Also:
    Constant Field Values

### FULL_DATA_RANGE

    public static final int FULL_DATA_RANGE

  Constant to indicate the full data range.

  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

### WARNING_TEXT

    public static final java.lang.String WARNING_TEXT

  The default text for the warning level.

  See Also:
    Constant Field Values

### CRITICAL_TEXT

    public static final java.lang.String CRITICAL_TEXT

  The default text for the critical level.

  See Also:
    Constant Field Values

### DEFAULT_METER_ANGLE

    public static final int DEFAULT_METER_ANGLE

  The default meter angle.

  See Also:
    Constant Field Values

### DEFAULT_BORDER_SIZE

    public static final float DEFAULT_BORDER_SIZE

  The default border size.

  See Also:
    Constant Field Values

### DEFAULT_CIRCLE_SIZE

    public static final float DEFAULT_CIRCLE_SIZE

  The default circle size.

  See Also:
    Constant Field Values

### DEFAULT_BACKGROUND_PAINT

    public static final java.awt.Paint DEFAULT_BACKGROUND_PAINT

  The default background color.

### DEFAULT_LABEL_FONT

    public static final java.awt.Font DEFAULT_LABEL_FONT

  The default label font.

### NO_LABELS

    public static final int NO_LABELS

  Constant for the label type.

  See Also:
    Constant Field Values

### VALUE_LABELS

    public static final int VALUE_LABELS

  Constant for the label type.

  See Also:
    Constant Field Values

### localizationResources

    protected static java.util.ResourceBundle localizationResources

  The resourceBundle for the localization.

### DIALTYPE_PIE

    public static final int DIALTYPE_PIE

  Constant for meter type 'pie'.

  See Also:
    Constant Field Values

### DIALTYPE_CIRCLE

    public static final int DIALTYPE_CIRCLE

  Constant for meter type 'circle'.

  See Also:
    Constant Field Values

### DIALTYPE_CHORD

    public static final int DIALTYPE_CHORD

  Constant for meter type 'chord'.

  See Also:
    Constant Field Values

Constructor Detail

### MeterPlot

    public MeterPlot()

  Creates a new plot with no dataset.

### MeterPlot

    public MeterPlot(ValueDataset dataset)

  Creates a new plot that displays the value in the supplied dataset.

Parameters:
  `dataset` - the dataset (`null` permitted).

Method Detail

### getUnits

    public java.lang.String getUnits()

  Returns the units for the dial.

  Returns:
    The units.

### setUnits

    public void setUnits(java.lang.String units)

  Sets the units for the dial.

  Parameters:
    `units` - the units.

### getRange

    public Range getRange()

  Returns the overall range for the dial.

  Returns:
    The overall range.

### setRange

    public void setRange(Range range)

  Sets the overall range for the dial.

  Parameters:
    `range` - the range.

### getNormalRange

    public Range getNormalRange()

  Returns the normal range for the dial.

  Returns:
    The normal range.

### setNormalRange

    public void setNormalRange(Range range)

  Sets the normal range for the dial.

  Parameters:
    `range` - the range.

### getWarningRange

    public Range getWarningRange()

  Returns the warning range for the dial.

  Returns:
    The warning range.

### setWarningRange

    public void setWarningRange(Range range)

  Sets the warning range for the dial.

  Parameters:
    `range` - the range.

### getCriticalRange

    public Range getCriticalRange()

  Returns the critical range for the dial.

  Returns:
    The critical range.

### setCriticalRange

    public void setCriticalRange(Range range)

  Sets the critical range for the dial.

  Parameters:
    `range` - the range.

### getDialShape

    public DialShape getDialShape()

  Returns the dial shape.

  Returns:
    The dial shape.

### setDialShape

    public void setDialShape(DialShape shape)

  Sets the dial shape.

  Parameters:
    `shape` - the shape.

### getDialBackgroundPaint

    public java.awt.Paint getDialBackgroundPaint()

  Returns the paint for the dial background.

  Returns:
    The paint (possibly `null`).

### setDialBackgroundPaint

    public void setDialBackgroundPaint(java.awt.Paint paint)

  Sets the paint used to fill the dial background.

  Parameters:
    `paint` - the paint (`null` permitted).

### getNeedlePaint

    public java.awt.Paint getNeedlePaint()

  Returns the paint for the needle.

  Returns:
    The paint.

### setNeedlePaint

    public void setNeedlePaint(java.awt.Paint paint)

  Sets the paint used to display the needle.

  If you set this to null, it will revert to the default color.

  Parameters:
    `paint` - The paint.

### getValueFont

    public java.awt.Font getValueFont()

  Returns the font for the value label.

  Returns:
    The font.

### setValueFont

    public void setValueFont(java.awt.Font font)

  Sets the font used to display the value label.

  If you set this to null, it will revert to the default font.

  Parameters:
    `font` - The font.

### getValuePaint

    public java.awt.Paint getValuePaint()

  Returns the paint for the value label.

  Returns:
    The paint.

### setValuePaint

    public void setValuePaint(java.awt.Paint paint)

  Sets the paint used to display the value label.

  If you set this to null, it will revert to the default paint.

  Parameters:
    `paint` - The paint.

### getNormalPaint

    public java.awt.Paint getNormalPaint()

  Returns the paint for the 'normal' level.

  Returns:
    The paint.

### setNormalPaint

    public void setNormalPaint(java.awt.Paint paint)

  Sets the paint used to display the 'normal' range.

  If you set this to null, it will revert to the default color.

  Parameters:
    `paint` - The paint.

### getWarningPaint

    public java.awt.Paint getWarningPaint()

  Returns the paint used to display the 'warning' range.

  Returns:
    The paint.

### setWarningPaint

    public void setWarningPaint(java.awt.Paint paint)

  Sets the paint used to display the 'warning' range.

  If you set this to null, it will revert to the default color.

  Parameters:
    `paint` - The paint.

### getCriticalPaint

    public java.awt.Paint getCriticalPaint()

  Returns the paint used to display the 'critical' range.

  Returns:
    The paint.

### setCriticalPaint

    public void setCriticalPaint(java.awt.Paint paint)

  Sets the paint used to display the 'critical' range.

  If you set this to null, it will revert to the default color.

  Parameters:
    `paint` - The paint.

### getTickLabelType

    public int getTickLabelType()

  Returns the tick label type. Defined by the constants: NO_LABELS, VALUE_LABELS.

  Returns:
    The tick label type.

### setTickLabelType

    public void setTickLabelType(int type)

  Sets the tick label type.

  Parameters:
    `type` - the type of tick labels - either `NO_LABELS` or `VALUE_LABELS`

### getTickLabelFont

    public java.awt.Font getTickLabelFont()

  Returns the tick label font.

  Returns:
    The font (never `null`).

### setTickLabelFont

    public void setTickLabelFont(java.awt.Font font)

  Sets the tick label font and sends a `PlotChangeEvent` to all registered listeners.

  Parameters:
    `font` - the font (`null` not permitted).

### getTickLabelFormat

    public java.text.NumberFormat getTickLabelFormat()

  Returns the tick label format.

  Returns:
    The tick label format (never `null`).

### setTickLabelFormat

    public void setTickLabelFormat(java.text.NumberFormat format)

  Sets the format for the tick labels and sends a `PlotChangeEvent` to all registered listeners.

  Parameters:
    `format` - the format (`null` not permitted).

### getDrawBorder

    public boolean getDrawBorder()

  Returns a flag that controls whether or not a rectangular border is drawn around the plot area.

  Returns:
    A flag.

### setDrawBorder

    public void setDrawBorder(boolean draw)

  Sets the flag that controls whether or not a rectangular border is drawn around the plot area.

  Note: it looks like the true setting needs some work to provide some insets.

  Parameters:
    `draw` - the flag.

### getMeterAngle

    public int getMeterAngle()

  Returns the meter angle.

  Returns:
    the meter angle.

### setMeterAngle

    public void setMeterAngle(int angle)

  Sets the range through which the dial's needle is free to rotate.

  Parameters:
    `angle` - the angle.

### getDialOutlinePaint

    public java.awt.Paint getDialOutlinePaint()

  Returns the dial outline paint.

  Returns:
    The paint.

### setDialOutlinePaint

    public void setDialOutlinePaint(java.awt.Paint paint)

  Sets the dial outline paint.

  Parameters:
    `paint` - the paint.

### getDataset

    public ValueDataset getDataset()

  Returns the primary dataset for the plot.

  Returns:
    The primary dataset (possibly `null`).

### setDataset

    public void setDataset(ValueDataset dataset)

  Sets the dataset for the plot, replacing the existing dataset if there is one.

  Parameters:
    `dataset` - the dataset (`null` permitted).

### getLegendItemLabels

    public java.util.List getLegendItemLabels()

  Deprecated. use getLegendItems().

  Returns a list of legend item labels.

  Returns:
    the legend item labels.

### getLegendItems

    public LegendItemCollection getLegendItems()

  Returns null.

  Overrides:
    `getLegendItems` in class `Plot`
  Returns:
    null.

### draw

    public void draw(java.awt.Graphics2D g2,
                     java.awt.geom.Rectangle2D plotArea,
                     PlotState parentState,
                     PlotRenderingInfo 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.
    `parentState` - the state from the parent plot, if there is one.
    `info` - collects info about the drawing.

### drawArcFor

    protected void drawArcFor(java.awt.Graphics2D g2,
                              java.awt.geom.Rectangle2D meterArea,
                              ValueDataset data,
                              int type)

  Draws a colored range (arc) for one level.

  Parameters:
    `g2` - The graphics device.
    `meterArea` - The drawing area.
    `data` - The dataset.
    `type` - The level.

### drawArc

    protected void drawArc(java.awt.Graphics2D g2,
                           java.awt.geom.Rectangle2D area,
                           double minValue,
                           double maxValue,
                           java.awt.Paint paint)

  Draws an arc.

  Parameters:
    `g2` - the graphics device.
    `area` - the plot area.
    `minValue` - the minimum value.
    `maxValue` - the maximum value.
    `paint` - the paint.

### drawArc

    protected void drawArc(java.awt.Graphics2D g2,
                           java.awt.geom.Rectangle2D area,
                           double minValue,
                           double maxValue,
                           java.awt.Paint paint,
                           int outlineType)

  Draws an arc.

  Parameters:
    `g2` - the graphics device.
    `area` - the plot area.
    `minValue` - the minimum value.
    `maxValue` - the maximum value.
    `paint` - the paint.
    `outlineType` - the outline type.

### drawTicks

    protected void drawTicks(java.awt.Graphics2D g2,
                             java.awt.geom.Rectangle2D meterArea,
                             double minValue,
                             double maxValue)

  Draws the ticks.

  Parameters:
    `g2` - the graphics device.
    `meterArea` - the meter area.
    `minValue` - the minimum value.
    `maxValue` - the maximum value.

### drawTick

    protected void drawTick(java.awt.Graphics2D g2,
                            java.awt.geom.Rectangle2D meterArea,
                            double value)

  Draws a tick.

  Parameters:
    `g2` - the graphics device.
    `meterArea` - the meter area.
    `value` - the value.

### drawTick

    protected void drawTick(java.awt.Graphics2D g2,
                            java.awt.geom.Rectangle2D meterArea,
                            double value,
                            boolean label,
                            java.awt.Paint color)

  Draws a tick.

  Parameters:
    `g2` - the graphics device.
    `meterArea` - the meter area.
    `value` - the value.
    `label` - the label.
    `color` - the color.

### drawTick

    protected void drawTick(java.awt.Graphics2D g2,
                            java.awt.geom.Rectangle2D meterArea,
                            double value,
                            boolean label,
                            java.awt.Paint labelPaint,
                            boolean curValue,
                            java.lang.String units)

  Draws a tick on the chart (also handles a special case [curValue=true] that draws the value in the middle of the dial).

  Parameters:
    `g2` - the graphics device.
    `meterArea` - the meter area.
    `value` - the tick value.
    `label` - a flag that controls whether or not a value label is drawn.
    `labelPaint` - the label color.
    `curValue` - a flag for the special case of the current value.
    `units` - the unit-of-measure for the dial.

### getPlotType

    public java.lang.String getPlotType()

  Returns a short string describing the type of plot.

  Specified by:
    `getPlotType` in class `Plot`
  Returns:
    always Meter Plot.

### 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 meter plot, it doesn't make sense to zoom in or out, so the method is empty.

  Overrides:
    `zoom` in class `Plot`
  Parameters:
    `percent` - The zoom percentage.

### equals

    public boolean equals(java.lang.Object object)

  Tests the plot for equality with an arbitrary object. Note that the dataset is ignored for the purposes of testing equality.

  Overrides:
    `equals` in class `Plot`
  Parameters:
    `object` - the object (`null` permitted).
  Returns:
    A boolean.

### getDialType

    public int getDialType()

  Deprecated. Use getDialShape().

  Returns the type of dial (DIALTYPE_PIE, DIALTYPE_CIRCLE, DIALTYPE_CHORD).

  Returns:
    The dial type.

### setDialType

    public void setDialType(int type)

  Deprecated. Use setDialShape(...).

  Sets the dial type (background shape).

  This controls the shape of the dial background. Use one of the constants: DIALTYPE_PIE, DIALTYPE_CIRCLE, or DIALTYPE_CHORD.

  Parameters:
    `type` - The dial type.

### clone

    public java.lang.Object clone()
                           throws java.lang.CloneNotSupportedException

  Correct cloning support, management of deeper copies and listeners

  Overrides:
    `clone` in class `Plot`
  Returns:
    A clone.
  Throws:
    `java.lang.CloneNotSupportedException` - if some component of the plot does not support cloning.
  See Also:
    `Plot.clone()`