Prev Class | Next Class | Frames | No Frames |
Summary: Nested | Field | Method | Constr | Detail: Nested | Field | Method | Constr |
java.lang.Object
org.jfree.chart.plot.Plot
org.jfree.chart.plot.MeterPlot
Field Summary | |
static float |
|
static float |
|
static Font |
|
static int |
|
protected static ResourceBundle |
|
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 | |
| |
|
Method Summary | |
void |
|
void |
|
Object |
|
void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
protected void |
|
boolean |
|
protected void |
|
ValueDataset |
|
Paint |
|
Paint |
|
DialShape |
|
boolean |
|
List |
|
LegendItemCollection |
|
int |
|
Paint |
|
String |
|
Range |
|
Font |
|
NumberFormat |
|
Paint |
|
boolean |
|
Paint |
|
double |
|
String |
|
Font |
|
Paint |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
void |
|
double |
|
void |
|
public static final float DEFAULT_BORDER_SIZE
The default border size.
- Field Value:
- 3.0f
public static final float DEFAULT_CIRCLE_SIZE
The default circle size.
- Field Value:
- 10.0f
public static final int DEFAULT_METER_ANGLE
The default meter angle.
- Field Value:
- 270
protected static ResourceBundle localizationResources
The resourceBundle for the localization.
public MeterPlot()
Creates a new plot with a default range of0
to100
and no value to display.
public MeterPlot(ValueDataset dataset)
Creates a new plot that displays the value from the supplied dataset.
- Parameters:
dataset
- the dataset (null
permitted).
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()
public void clearIntervals()
Clears the intervals for the plot and sends aPlotChangeEvent
to all registered listeners.
- See Also:
addInterval(MeterInterval)
public Object clone() throws 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.
- Returns:
- A clone.
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).
- Parameters:
g2
- the graphics device.area
- the area within which the plot should be drawn.anchor
- the anchor point (null
permitted).parentState
- the state from the parent plot, if there is one.info
- collects info about the drawing.
protected void drawArc(Graphics2D g2, Rectangle2D area, double minValue, double maxValue, Paint paint, 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.
protected void drawArcForInterval(Graphics2D g2, Rectangle2D meterArea, MeterInterval interval)
Draws the arc to represent an interval.
- Parameters:
g2
- the graphics device.meterArea
- the drawing area.interval
- the interval.
protected void drawTick(Graphics2D g2, Rectangle2D meterArea, double value)
Draws a tick.
- Parameters:
g2
- the graphics device.meterArea
- the meter area.value
- the value.
protected void drawTick(Graphics2D g2, 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.
protected void drawTicks(Graphics2D g2, 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.
protected void drawValueLabel(Graphics2D g2, Rectangle2D area)
Draws the value label just below the center of the dial.
- Parameters:
g2
- the graphics device.area
- the plot area.
public boolean equals(Object obj)
Tests the plot for equality with an arbitrary object. Note that the dataset is ignored for the purposes of testing equality.
- Parameters:
obj
- the object (null
permitted).
- Returns:
- A boolean.
protected void fillArc(Graphics2D g2, Rectangle2D area, double minValue, double maxValue, 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.
public ValueDataset getDataset()
Returns the dataset for the plot.
- Returns:
- The dataset (possibly
null
).
- See Also:
setDataset(ValueDataset)
public Paint getDialBackgroundPaint()
Returns the paint for the dial background.
- Returns:
- The paint (possibly
null
).
- See Also:
setDialBackgroundPaint(Paint)
public Paint getDialOutlinePaint()
Returns the dial outline paint.
- Returns:
- The paint.
- See Also:
setDialOutlinePaint(Paint)
public DialShape getDialShape()
Returns the dial shape. The default isDialShape.CIRCLE
).
- Returns:
- The dial shape (never
null
).
- See Also:
setDialShape(DialShape)
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)
public List getIntervals()
Returns an unmodifiable list of the intervals for the plot.
- Returns:
- A list.
- See Also:
addInterval(MeterInterval)
public LegendItemCollection getLegendItems()
Returns an item for each interval.
- Specified by:
- getLegendItems in interface LegendItemSource
- Overrides:
- getLegendItems in interface Plot
- Returns:
- A collection of legend items.
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)
public Paint getNeedlePaint()
Returns the paint for the needle.
- Returns:
- The paint (never
null
).
- See Also:
setNeedlePaint(Paint)
public String getPlotType()
Returns a short string describing the type of plot.
- Overrides:
- getPlotType in interface Plot
- Returns:
- A string describing the type of plot.
public Range getRange()
Returns the overall range for the dial.
- Returns:
- The overall range (never
null
).
- See Also:
setRange(Range)
public Font getTickLabelFont()
Returns the tick label font.
- Returns:
- The font (never
null
).
- See Also:
setTickLabelFont(Font)
public NumberFormat getTickLabelFormat()
Returns the tick label format.
- Returns:
- The tick label format (never
null
).
- See Also:
setTickLabelFormat(NumberFormat)
public Paint getTickLabelPaint()
Returns the tick label paint.
- Returns:
- The paint (never
null
).
- See Also:
setTickLabelPaint(Paint)
public boolean getTickLabelsVisible()
Returns the flag that determines whether or not tick labels are visible.
- Returns:
- The flag.
- See Also:
setTickLabelsVisible(boolean)
public 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)
public double getTickSize()
Returns the tick size (the interval between ticks on the dial).
- Returns:
- The tick size.
- See Also:
setTickSize(double)
public String getUnits()
Returns a string describing the units for the dial.
- Returns:
- The units (possibly
null
).
- See Also:
setUnits(String)
public Font getValueFont()
Returns the font for the value label.
- Returns:
- The font (never
null
).
- See Also:
setValueFont(Font)
public Paint getValuePaint()
Returns the paint for the value label.
- Returns:
- The paint (never
null
).
- See Also:
setValuePaint(Paint)
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()
public void setDialBackgroundPaint(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()
public void setDialOutlinePaint(Paint paint)
Sets the dial outline paint and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint.
- See Also:
getDialOutlinePaint()
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()
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()
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()
public void setNeedlePaint(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()
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()
public void setTickLabelFont(Font font)
Sets the tick label font and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
font
- the font (null
not permitted).
- See Also:
getTickLabelFont()
public void setTickLabelFormat(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()
public void setTickLabelPaint(Paint paint)
Sets the tick label paint and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
paint
- the paint (null
not permitted).
- See Also:
getTickLabelPaint()
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()
public void setTickPaint(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()
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()
public void setUnits(String units)
Sets the units for the dial and sends aPlotChangeEvent
to all registered listeners.
- Parameters:
units
- the units (null
permitted).
- See Also:
getUnits()
public void setValueFont(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()
public void setValuePaint(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()
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.