Package org.jfree.chart.plot
Class MeterPlot
- java.lang.Object
-
- org.jfree.chart.plot.Plot
-
- org.jfree.chart.plot.MeterPlot
-
- All Implemented Interfaces:
java.io.Serializable
,java.lang.Cloneable
,java.util.EventListener
,AnnotationChangeListener
,AxisChangeListener
,MarkerChangeListener
,LegendItemSource
,PublicCloneable
,DatasetChangeListener
public class MeterPlot extends Plot implements java.io.Serializable, java.lang.Cloneable
A plot that displays a single value in the form of a needle on a dial. Defined ranges (for example, 'normal', 'warning' and 'critical') can be highlighted on the dial.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private ValueDataset
dataset
The dataset (contains a single value).static float
DEFAULT_BORDER_SIZE
The default border size.static float
DEFAULT_CIRCLE_SIZE
The default circle size.(package private) static java.awt.Paint
DEFAULT_DIAL_BACKGROUND_PAINT
The default background paint.static java.awt.Font
DEFAULT_LABEL_FONT
The default label font.static int
DEFAULT_METER_ANGLE
The default meter angle.(package private) static java.awt.Paint
DEFAULT_NEEDLE_PAINT
The default needle paint.(package private) static java.awt.Font
DEFAULT_VALUE_FONT
The default value font.(package private) static java.awt.Paint
DEFAULT_VALUE_PAINT
The default value paint.private java.awt.Paint
dialBackgroundPaint
The paint for the dial background.private java.awt.Paint
dialOutlinePaint
The outline paint.private boolean
drawBorder
A flag that controls whether or not the border is drawn.private java.util.List<MeterInterval>
intervals
A (possibly empty) list of theMeterInterval
s to be highlighted on the dial.protected static java.util.ResourceBundle
localizationResources
The resourceBundle for the localization.private int
meterAngle
The dial extent (measured in degrees).private java.awt.Paint
needlePaint
The paint for the needle.private Range
range
The overall range of data values on the dial.private static long
serialVersionUID
For serialization.private DialShape
shape
The dial shape (background shape).private java.awt.Font
tickLabelFont
The tick label font.private java.text.NumberFormat
tickLabelFormat
The tick label format.private java.awt.Paint
tickLabelPaint
The tick label paint.private boolean
tickLabelsVisible
A flag that controls whether or not the tick labels are visible.private java.awt.Paint
tickPaint
The paint used to draw the ticks.private double
tickSize
The tick size.private java.lang.String
units
The units displayed on the dial.private java.awt.Font
valueFont
The font for the value displayed in the center of the dial.private java.awt.Paint
valuePaint
The paint for the value displayed in the center of the dial.private boolean
valueVisible
A flag that indicates whether the value is visible.-
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
Constructors Constructor Description MeterPlot()
Creates a new plot with a default range of0
to100
and no value to display.MeterPlot(ValueDataset dataset)
Creates a new plot that displays the value from the supplied dataset.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addInterval(MeterInterval interval)
Adds an interval and sends aPlotChangeEvent
to all registered listeners.void
clearIntervals()
Clears the intervals for the plot and sends aPlotChangeEvent
to all registered listeners.java.lang.Object
clone()
Returns an independent copy (clone) of the plot.void
draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.awt.geom.Point2D anchor, 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, java.awt.Stroke stroke)
Draws an arc.protected void
drawArcForInterval(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D meterArea, MeterInterval interval)
Draws the arc to represent an interval.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)
Draws a tick on the dial.protected void
drawTicks(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D meterArea, double minValue, double maxValue)
Draws the ticks that subdivide the overall range.protected void
drawValueLabel(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
Draws the value label just below the center of the dial.boolean
equals(java.lang.Object obj)
Tests the plot for equality with an arbitrary object.protected void
fillArc(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, double minValue, double maxValue, java.awt.Paint paint, boolean dial)
Fills an arc on the dial between the given values.ValueDataset
getDataset()
Returns the 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.boolean
getDrawBorder()
Returns a flag that controls whether or not a rectangular border is drawn around the plot area.java.util.List<MeterInterval>
getIntervals()
Returns an unmodifiable list of the intervals for the plot.LegendItemCollection
getLegendItems()
Returns an item for each interval.int
getMeterAngle()
Returns the meter angle in degrees.java.awt.Paint
getNeedlePaint()
Returns the paint for the needle.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.java.awt.Paint
getTickLabelPaint()
Returns the tick label paint.boolean
getTickLabelsVisible()
Returns the flag that determines whether or not tick labels are visible.java.awt.Paint
getTickPaint()
Returns the paint used to draw the ticks around the dial.double
getTickSize()
Returns the tick size (the interval between ticks on the dial).java.lang.String
getUnits()
Returns a string describing 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.boolean
isValueVisible()
Returns the flag that controls whether or not the value is visible.private void
readObject(java.io.ObjectInputStream stream)
Provides serialization support.void
setDataset(ValueDataset dataset)
Sets the dataset for the plot, replacing the existing dataset if there is one, and triggers aPlotChangeEvent
.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 and sends aPlotChangeEvent
to all registered listeners.void
setDialShape(DialShape shape)
Sets the dial shape and sends aPlotChangeEvent
to all registered listeners.void
setDrawBorder(boolean draw)
Sets the flag that controls whether or not a rectangular border is drawn around the plot area and sends aPlotChangeEvent
to all registered listeners.void
setMeterAngle(int angle)
Sets the angle (in degrees) for the whole range of the dial and sends aPlotChangeEvent
to all registered listeners.void
setNeedlePaint(java.awt.Paint paint)
Sets the paint used to display the needle and sends aPlotChangeEvent
to all registered listeners.void
setRange(Range range)
Sets the range for the dial and sends aPlotChangeEvent
to all registered listeners.void
setTickLabelFont(java.awt.Font font)
Sets the tick label font and sends aPlotChangeEvent
to all registered listeners.void
setTickLabelFormat(java.text.NumberFormat format)
Sets the format for the tick labels and sends aPlotChangeEvent
to all registered listeners.void
setTickLabelPaint(java.awt.Paint paint)
Sets the tick label paint and sends aPlotChangeEvent
to all registered listeners.void
setTickLabelsVisible(boolean visible)
Sets the flag that controls whether or not the tick labels are visible and sends aPlotChangeEvent
to all registered listeners.void
setTickPaint(java.awt.Paint paint)
Sets the paint used to draw the tick labels around the dial and sends aPlotChangeEvent
to all registered listeners.void
setTickSize(double size)
Sets the tick size and sends aPlotChangeEvent
to all registered listeners.void
setUnits(java.lang.String units)
Sets the units for the dial and sends aPlotChangeEvent
to all registered listeners.void
setValueFont(java.awt.Font font)
Sets the font used to display the value label and sends aPlotChangeEvent
to all registered listeners.void
setValuePaint(java.awt.Paint paint)
Sets the paint used to display the value label and sends aPlotChangeEvent
to all registered listeners.void
setValueVisible(boolean valueVisible)
Sets the flag that controls whether or not the value is visible and sends a change event to all registered listeners.double
valueToAngle(double value)
Translates a data value to an angle on the dial.private void
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.void
zoom(double percent)
A zoom method that does nothing.-
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 Detail
-
serialVersionUID
private static final long serialVersionUID
For serialization.- See Also:
- Constant Field Values
-
DEFAULT_DIAL_BACKGROUND_PAINT
static final java.awt.Paint DEFAULT_DIAL_BACKGROUND_PAINT
The default background paint.
-
DEFAULT_NEEDLE_PAINT
static final java.awt.Paint DEFAULT_NEEDLE_PAINT
The default needle paint.
-
DEFAULT_VALUE_FONT
static final java.awt.Font DEFAULT_VALUE_FONT
The default value font.
-
DEFAULT_VALUE_PAINT
static final java.awt.Paint DEFAULT_VALUE_PAINT
The default value paint.
-
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_LABEL_FONT
public static final java.awt.Font DEFAULT_LABEL_FONT
The default label font.
-
dataset
private ValueDataset dataset
The dataset (contains a single value).
-
shape
private DialShape shape
The dial shape (background shape).
-
meterAngle
private int meterAngle
The dial extent (measured in degrees).
-
range
private Range range
The overall range of data values on the dial.
-
tickSize
private double tickSize
The tick size.
-
tickPaint
private transient java.awt.Paint tickPaint
The paint used to draw the ticks.
-
units
private java.lang.String units
The units displayed on the dial.
-
valueFont
private java.awt.Font valueFont
The font for the value displayed in the center of the dial.
-
valuePaint
private transient java.awt.Paint valuePaint
The paint for the value displayed in the center of the dial.
-
valueVisible
private boolean valueVisible
A flag that indicates whether the value is visible.
-
drawBorder
private boolean drawBorder
A flag that controls whether or not the border is drawn.
-
dialOutlinePaint
private transient java.awt.Paint dialOutlinePaint
The outline paint.
-
dialBackgroundPaint
private transient java.awt.Paint dialBackgroundPaint
The paint for the dial background.
-
needlePaint
private transient java.awt.Paint needlePaint
The paint for the needle.
-
tickLabelsVisible
private boolean tickLabelsVisible
A flag that controls whether or not the tick labels are visible.
-
tickLabelFont
private java.awt.Font tickLabelFont
The tick label font.
-
tickLabelPaint
private transient java.awt.Paint tickLabelPaint
The tick label paint.
-
tickLabelFormat
private java.text.NumberFormat tickLabelFormat
The tick label format.
-
localizationResources
protected static java.util.ResourceBundle localizationResources
The resourceBundle for the localization.
-
intervals
private java.util.List<MeterInterval> intervals
A (possibly empty) list of theMeterInterval
s to be highlighted on the dial.
-
-
Constructor Detail
-
MeterPlot
public MeterPlot()
Creates a new plot with a default range of0
to100
and no value to display.
-
MeterPlot
public MeterPlot(ValueDataset dataset)
Creates a new plot that displays the value from the supplied dataset.- Parameters:
dataset
- the dataset (null
permitted).
-
-
Method Detail
-
getDialShape
public DialShape getDialShape()
Returns the dial shape. The default isDialShape.CIRCLE
).- Returns:
- The dial shape (never
null
). - See Also:
setDialShape(DialShape)
-
setDialShape
public void setDialShape(DialShape shape)
Sets the dial shape and sends aPlotChangeEvent
to all registered listeners.- Parameters:
shape
- the shape (null
not permitted).- See Also:
getDialShape()
-
getMeterAngle
public int getMeterAngle()
Returns the meter angle in degrees. This defines, in part, the shape of the dial. The default is 270 degrees.- Returns:
- The meter angle (in degrees).
- See Also:
setMeterAngle(int)
-
setMeterAngle
public void setMeterAngle(int angle)
Sets the angle (in degrees) for the whole range of the dial and sends aPlotChangeEvent
to all registered listeners.- Parameters:
angle
- the angle (in degrees, in the range 1-360).- See Also:
getMeterAngle()
-
getRange
public Range getRange()
Returns the overall range for the dial.- Returns:
- The overall range (never
null
). - See Also:
setRange(Range)
-
setRange
public void setRange(Range range)
Sets the range for the dial and sends aPlotChangeEvent
to all registered listeners.- Parameters:
range
- the range (null
not permitted and zero-length ranges not permitted).- See Also:
getRange()
-
getTickSize
public double getTickSize()
Returns the tick size (the interval between ticks on the dial).- Returns:
- The tick size.
- See Also:
setTickSize(double)
-
setTickSize
public void setTickSize(double size)
Sets the tick size and sends aPlotChangeEvent
to all registered listeners.- Parameters:
size
- the tick size (must be > 0).- See Also:
getTickSize()
-
getTickPaint
public java.awt.Paint getTickPaint()
Returns the paint used to draw the ticks around the dial.- Returns:
- The paint used to draw the ticks around the dial (never
null
). - See Also:
setTickPaint(Paint)
-
setTickPaint
public void setTickPaint(java.awt.Paint paint)
Sets the paint used to draw the tick labels around the dial and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getTickPaint()
-
getUnits
public java.lang.String getUnits()
Returns a string describing the units for the dial.- Returns:
- The units (possibly
null
). - See Also:
setUnits(String)
-
setUnits
public void setUnits(java.lang.String units)
Sets the units for the dial and sends aPlotChangeEvent
to all registered listeners.- Parameters:
units
- the units (null
permitted).- See Also:
getUnits()
-
getNeedlePaint
public java.awt.Paint getNeedlePaint()
Returns the paint for the needle.- Returns:
- The paint (never
null
). - See Also:
setNeedlePaint(Paint)
-
setNeedlePaint
public void setNeedlePaint(java.awt.Paint paint)
Sets the paint used to display the needle and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getNeedlePaint()
-
getTickLabelsVisible
public boolean getTickLabelsVisible()
Returns the flag that determines whether or not tick labels are visible.- Returns:
- The flag.
- See Also:
setTickLabelsVisible(boolean)
-
setTickLabelsVisible
public void setTickLabelsVisible(boolean visible)
Sets the flag that controls whether or not the tick labels are visible and sends aPlotChangeEvent
to all registered listeners.- Parameters:
visible
- the flag.- See Also:
getTickLabelsVisible()
-
getTickLabelFont
public java.awt.Font getTickLabelFont()
Returns the tick label font.- Returns:
- The font (never
null
). - See Also:
setTickLabelFont(Font)
-
setTickLabelFont
public void setTickLabelFont(java.awt.Font font)
Sets the tick label font and sends aPlotChangeEvent
to all registered listeners.- Parameters:
font
- the font (null
not permitted).- See Also:
getTickLabelFont()
-
getTickLabelPaint
public java.awt.Paint getTickLabelPaint()
Returns the tick label paint.- Returns:
- The paint (never
null
). - See Also:
setTickLabelPaint(Paint)
-
setTickLabelPaint
public void setTickLabelPaint(java.awt.Paint paint)
Sets the tick label paint and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getTickLabelPaint()
-
isValueVisible
public boolean isValueVisible()
Returns the flag that controls whether or not the value is visible. The default value istrue
.- Returns:
- A flag.
- Since:
- 1.5.4
- See Also:
setValueVisible(boolean)
-
setValueVisible
public void setValueVisible(boolean valueVisible)
Sets the flag that controls whether or not the value is visible and sends a change event to all registered listeners.- Parameters:
valueVisible
- the new flag value.- Since:
- 1.5.4
- See Also:
isValueVisible()
-
getTickLabelFormat
public java.text.NumberFormat getTickLabelFormat()
Returns the tick label format.- Returns:
- The tick label format (never
null
). - See Also:
setTickLabelFormat(NumberFormat)
-
setTickLabelFormat
public void setTickLabelFormat(java.text.NumberFormat format)
Sets the format for the tick labels and sends aPlotChangeEvent
to all registered listeners.- Parameters:
format
- the format (null
not permitted).- See Also:
getTickLabelFormat()
-
getValueFont
public java.awt.Font getValueFont()
Returns the font for the value label.- Returns:
- The font (never
null
). - See Also:
setValueFont(Font)
-
setValueFont
public void setValueFont(java.awt.Font font)
Sets the font used to display the value label and sends aPlotChangeEvent
to all registered listeners.- Parameters:
font
- the font (null
not permitted).- See Also:
getValueFont()
-
getValuePaint
public java.awt.Paint getValuePaint()
Returns the paint for the value label.- Returns:
- The paint (never
null
). - See Also:
setValuePaint(Paint)
-
setValuePaint
public void setValuePaint(java.awt.Paint paint)
Sets the paint used to display the value label and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint (null
not permitted).- See Also:
getValuePaint()
-
getDialBackgroundPaint
public java.awt.Paint getDialBackgroundPaint()
Returns the paint for the dial background.- Returns:
- The paint (possibly
null
). - See Also:
setDialBackgroundPaint(Paint)
-
setDialBackgroundPaint
public void setDialBackgroundPaint(java.awt.Paint paint)
Sets the paint used to fill the dial background. Set this tonull
for no background.- Parameters:
paint
- the paint (null
permitted).- See Also:
getDialBackgroundPaint()
-
getDrawBorder
public boolean getDrawBorder()
Returns a flag that controls whether or not a rectangular border is drawn around the plot area.- Returns:
- A flag.
- See Also:
setDrawBorder(boolean)
-
setDrawBorder
public void setDrawBorder(boolean draw)
Sets the flag that controls whether or not a rectangular border is drawn around the plot area and sends aPlotChangeEvent
to all registered listeners.- Parameters:
draw
- the flag.- See Also:
getDrawBorder()
-
getDialOutlinePaint
public java.awt.Paint getDialOutlinePaint()
Returns the dial outline paint.- Returns:
- The paint.
- See Also:
setDialOutlinePaint(Paint)
-
setDialOutlinePaint
public void setDialOutlinePaint(java.awt.Paint paint)
Sets the dial outline paint and sends aPlotChangeEvent
to all registered listeners.- Parameters:
paint
- the paint.- See Also:
getDialOutlinePaint()
-
getDataset
public ValueDataset getDataset()
Returns the dataset for the plot.- Returns:
- The dataset (possibly
null
). - See Also:
setDataset(ValueDataset)
-
setDataset
public void setDataset(ValueDataset dataset)
Sets the dataset for the plot, replacing the existing dataset if there is one, and triggers aPlotChangeEvent
.- Parameters:
dataset
- the dataset (null
permitted).- See Also:
getDataset()
-
getIntervals
public java.util.List<MeterInterval> getIntervals()
Returns an unmodifiable list of the intervals for the plot.- Returns:
- A list.
- See Also:
addInterval(MeterInterval)
-
addInterval
public void addInterval(MeterInterval interval)
Adds an interval and sends aPlotChangeEvent
to all registered listeners.- Parameters:
interval
- the interval (null
not permitted).- See Also:
getIntervals()
,clearIntervals()
-
clearIntervals
public void clearIntervals()
Clears the intervals for the plot and sends aPlotChangeEvent
to all registered listeners.- See Also:
addInterval(MeterInterval)
-
getLegendItems
public LegendItemCollection getLegendItems()
Returns an item for each interval.- Specified by:
getLegendItems
in interfaceLegendItemSource
- Overrides:
getLegendItems
in classPlot
- Returns:
- A collection of legend items.
-
draw
public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.awt.geom.Point2D anchor, PlotState parentState, PlotRenderingInfo info)
Draws the plot on a Java 2D graphics device (such as the screen or a printer).
-
drawArcForInterval
protected void drawArcForInterval(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D meterArea, MeterInterval interval)
Draws the arc to represent an interval.- Parameters:
g2
- the graphics device.meterArea
- the drawing area.interval
- the interval.
-
drawArc
protected void drawArc(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, double minValue, double maxValue, java.awt.Paint paint, java.awt.Stroke stroke)
Draws an arc.- Parameters:
g2
- the graphics device.area
- the plot area.minValue
- the minimum value.maxValue
- the maximum value.paint
- the paint.stroke
- the stroke.
-
fillArc
protected void fillArc(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, double minValue, double maxValue, java.awt.Paint paint, boolean dial)
Fills an arc on the dial between the given values.- Parameters:
g2
- the graphics device.area
- the plot area.minValue
- the minimum data value.maxValue
- the maximum data value.paint
- the background paint (null
not permitted).dial
- a flag that indicates whether the arc represents the whole dial.
-
valueToAngle
public double valueToAngle(double value)
Translates a data value to an angle on the dial.- Parameters:
value
- the value.- Returns:
- The angle on the dial.
-
drawTicks
protected void drawTicks(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D meterArea, double minValue, double maxValue)
Draws the ticks that subdivide the overall range.- 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)
Draws a tick on 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.
-
drawValueLabel
protected void drawValueLabel(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
Draws the value label just below the center of the dial.- Parameters:
g2
- the graphics device.area
- the plot area.
-
getPlotType
public java.lang.String getPlotType()
Returns a short string describing the type of plot.- Specified by:
getPlotType
in classPlot
- Returns:
- A string describing the type of 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.
-
equals
public boolean equals(java.lang.Object obj)
Tests the plot for equality with an arbitrary object. Note that the dataset is ignored for the purposes of testing equality.
-
writeObject
private void writeObject(java.io.ObjectOutputStream stream) throws java.io.IOException
Provides serialization support.- Parameters:
stream
- the output stream.- Throws:
java.io.IOException
- if there is an I/O error.
-
readObject
private void readObject(java.io.ObjectInputStream stream) throws java.io.IOException, java.lang.ClassNotFoundException
Provides serialization support.- Parameters:
stream
- the input stream.- Throws:
java.io.IOException
- if there is an I/O error.java.lang.ClassNotFoundException
- if there is a classpath problem.
-
clone
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
Returns an independent copy (clone) of the plot. The dataset is NOT cloned - both the original and the clone will have a reference to the same dataset.- Specified by:
clone
in interfacePublicCloneable
- Overrides:
clone
in classPlot
- Returns:
- A clone.
- Throws:
java.lang.CloneNotSupportedException
- if some component of the plot cannot be cloned.
-
-