|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.jfree.chart.plot.Plot | +--org.jfree.chart.plot.ThermometerPlot
A plot that displays a single value in a thermometer type display.
NOTE: The Thermometer plot utilises a meter data set, however range options within this data set are not used (instead, the ranges can be set as attributes on the plot). This plot supports a number of options:
Field Summary | |
protected static int |
AXIS_GAP
The axis gap. |
static int |
BULB
A constant for the value label position (in the thermometer bulb). |
protected static int |
BULB_DIAMETER
The bulb diameter. |
protected static int |
BULB_RADIUS
The bulb radius. |
protected static int |
COLUMN_DIAMETER
The column diameter. |
protected static int |
COLUMN_RADIUS
The column radius. |
static int |
CRITICAL
A constant for the 'critical' range. |
protected static double |
DEFAULT_LOWER_BOUND
The default lower bound. |
protected static double |
DEFAULT_UPPER_BOUND
The default upper bound. |
protected static int |
DISPLAY_HIGH
Index for display high value in subrangeInfo matrix. |
protected static int |
DISPLAY_LOW
Index for display low value in subrangeInfo matrix. |
protected static int |
GAP_DIAMETER
The gap diameter. |
protected static int |
GAP_RADIUS
The gap radius. |
static int |
NONE
A constant for the value label position (no label). |
static int |
NORMAL
A constant for the 'normal' range. |
protected static int |
RANGE_HIGH
Index for high value in subrangeInfo matrix. |
protected static int |
RANGE_LOW
Index for low value in subrangeInfo matrix. |
static int |
RIGHT
A constant for the value label position (right of the thermometer). |
protected static java.lang.String[] |
UNITS
The unit strings. |
static int |
UNITS_CELCIUS
A constant for unit type 'Celcius'. |
static int |
UNITS_FAHRENHEIT
A constant for unit type 'Fahrenheit'. |
static int |
UNITS_KELVIN
A constant for unit type 'Kelvin'. |
static int |
UNITS_NONE
A constant for unit type 'None'. |
static int |
WARNING
A constant for the 'warning' range. |
Fields inherited from class org.jfree.chart.plot.Plot |
DEFAULT_BACKGROUND_ALPHA, DEFAULT_BACKGROUND_PAINT, DEFAULT_FOREGROUND_ALPHA, DEFAULT_INSETS, DEFAULT_OUTLINE_PAINT, DEFAULT_OUTLINE_STROKE, MINIMUM_HEIGHT_TO_DRAW, MINIMUM_WIDTH_TO_DRAW, ZERO |
Constructor Summary | |
ThermometerPlot()
Creates a new thermometer plot. |
|
ThermometerPlot(ValueDataset data)
Creates a new thermometer plot, using default attributes where necessary. |
Method Summary | |
void |
datasetChanged(DatasetChangeEvent event)
Checks to see if a new value means the axis range needs adjusting. |
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). |
boolean |
equals(java.lang.Object obj)
Tests this plot for equality with another object. |
ValueDataset |
getData()
Returns the dataset cast to ValueDataset (provided for convenience). |
boolean |
getFollowDataInSubranges()
Returns a flag that controls whether or not the thermometer axis zooms to display the subrange within which the data value falls. |
java.util.List |
getLegendItemLabels()
Deprecated. use getLegendItems(). |
LegendItemCollection |
getLegendItems()
Returns the legend items for the plot. |
double |
getLowerBound()
Returns the lower bound for the thermometer. |
java.lang.Number |
getMaximumVerticalDataValue()
Returns the maximum value in either the domain or the range, whichever is displayed against the vertical axis for the particular type of plot implementing this interface. |
java.awt.Paint |
getMercuryPaint()
Returns the default mercury paint. |
java.lang.Number |
getMinimumVerticalDataValue()
Returns the minimum value in either the domain or the range, whichever is displayed against the vertical axis for the particular type of plot implementing this interface. |
Spacer |
getPadding()
Returns the padding for the thermometer. |
java.lang.String |
getPlotType()
Returns a short string describing the type of plot. |
ValueAxis |
getRangeAxis()
Returns the range axis. |
boolean |
getShowValueLines()
Returns the flag that controls whether not value lines are displayed. |
java.awt.Paint |
getSubrangePaint(int range)
Gets the paint used for a particular subrange. |
java.awt.Paint |
getThermometerPaint()
Returns the paint used to draw the thermometer outline. |
java.awt.Stroke |
getThermometerStroke()
Returns the stroke used to draw the thermometer outline. |
int |
getUnits()
Returns the unit display type (none/Fahrenheit/Celcius/Kelvin). |
double |
getUpperBound()
Returns the upper bound for the thermometer. |
boolean |
getUseSubrangePaint()
Returns a flag that controls whether or not the mercury color changes for each subrange. |
java.awt.Font |
getValueFont()
Gets the font used to display the current value. |
int |
getValueLocation()
Returns the value location. |
java.awt.Paint |
getValuePaint()
Gets the paint used to display the current value. |
Range |
getVerticalDataRange(ValueAxis axis)
Returns the vertical data range. |
ValueAxis |
getVerticalValueAxis()
Returns the vertical value axis. |
boolean |
isCompatibleHorizontalAxis(Axis axis)
Returns true if the axis is compatible with the meter plot. |
boolean |
isCompatibleRangeAxis(ValueAxis axis)
Checks the compatibility of a range axis, returning true if the axis is compatible with the plot, and false otherwise. |
boolean |
isCompatibleVerticalAxis(Axis axis)
Returns true if the axis is compatible with the meter plot. |
protected static boolean |
isValidNumber(double d)
Determine whether a number is valid and finite. |
void |
propertyChange()
Deprecated. this method is not required and will be removed. |
protected void |
setAxisRange()
Sets the axis range to the current values in the rangeInfo array. |
void |
setData(ValueDataset data)
Sets the data for the chart, replacing any existing data. |
void |
setDisplayRange(int range,
double low,
double high)
Sets the display range. |
void |
setFollowDataInSubranges(boolean flag)
Sets the flag that controls whether or not the thermometer axis zooms to display the subrange within which the data value falls. |
void |
setLowerBound(double lower)
Sets the lower bound for the thermometer. |
void |
setMercuryPaint(java.awt.Paint paint)
Sets the default mercury paint. |
void |
setPadding(Spacer padding)
Sets the padding for the thermometer. |
void |
setRange(double lower,
double upper)
Sets the lower and upper bounds for the thermometer. |
void |
setRangeAxis(ValueAxis axis)
Sets the range axis for the plot. |
void |
setShowValueLines(boolean b)
Sets the display as to whether to show value lines in the output. |
void |
setSubrange(int range,
double low,
double high)
Sets the range. |
void |
setSubrangeInfo(int range,
double low,
double hi)
Sets information for a particular range. |
void |
setSubrangeInfo(int range,
double rangeLow,
double rangeHigh,
double displayLow,
double displayHigh)
Sets the subrangeInfo attribute of the ThermometerPlot object |
void |
setSubrangePaint(int range,
java.awt.Paint paint)
Sets the paint to be used for a range. |
void |
setThermometerPaint(java.awt.Paint paint)
Sets the paint used to draw the thermometer outline. |
void |
setThermometerStroke(java.awt.Stroke s)
Sets the stroke used to draw the thermometer outline. |
void |
setUnits(int u)
Sets the units to be displayed in the thermometer. |
void |
setUnits(java.lang.String u)
Sets the unit type. |
void |
setUpperBound(double upper)
Sets the upper bound for the thermometer. |
void |
setUseSubrangePaint(boolean flag)
Sets the range colour change option. |
void |
setValueFont(java.awt.Font f)
Sets the font used to display the current value. |
void |
setValueFormat(java.text.NumberFormat formatter)
Sets the formatter for the value label. |
void |
setValueLocation(int location)
Sets the location at which the current value is displayed. |
void |
setValuePaint(java.awt.Paint p)
Sets the paint used to display the current value. |
void |
zoom(double percent)
A zoom method that does nothing. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int UNITS_NONE
public static final int UNITS_FAHRENHEIT
public static final int UNITS_CELCIUS
public static final int UNITS_KELVIN
public static final int NONE
public static final int RIGHT
public static final int BULB
public static final int NORMAL
public static final int WARNING
public static final int CRITICAL
protected static final int BULB_RADIUS
protected static final int BULB_DIAMETER
protected static final int COLUMN_RADIUS
protected static final int COLUMN_DIAMETER
protected static final int GAP_RADIUS
protected static final int GAP_DIAMETER
protected static final int AXIS_GAP
protected static final java.lang.String[] UNITS
protected static final int RANGE_LOW
protected static final int RANGE_HIGH
protected static final int DISPLAY_LOW
protected static final int DISPLAY_HIGH
protected static final double DEFAULT_LOWER_BOUND
protected static final double DEFAULT_UPPER_BOUND
Constructor Detail |
public ThermometerPlot()
public ThermometerPlot(ValueDataset data)
data
- the data set.Method Detail |
public ValueDataset getData()
public void setData(ValueDataset data)
Registered listeners are notified that the plot has been modified (this will normally trigger a chart redraw).
data
- the new dataset.public ValueAxis getRangeAxis()
public void setRangeAxis(ValueAxis axis) throws AxisNotCompatibleException
An exception is thrown if the new axis and the plot are not mutually compatible.
axis
- the new axis.
AxisNotCompatibleException
- if the axis is not compatible with the plot.public double getLowerBound()
The data value can be set lower than this, but it will not be shown in the thermometer.
public void setLowerBound(double lower)
lower
- the lower bound.public double getUpperBound()
The data value can be set higher than this, but it will not be shown in the thermometer.
public void setUpperBound(double upper)
upper
- the upper bound.public void setRange(double lower, double upper)
lower
- the lower bound.upper
- the upper bound.public Spacer getPadding()
public void setPadding(Spacer padding)
padding
- the padding.public java.awt.Stroke getThermometerStroke()
public void setThermometerStroke(java.awt.Stroke s)
s
- the new stroke (null ignored).public java.awt.Paint getThermometerPaint()
public void setThermometerPaint(java.awt.Paint paint)
paint
- the new paint (null ignored).public int getUnits()
public void setUnits(int u)
Use one of the following constants:
u
- the new unit type.public void setUnits(java.lang.String u)
u
- the unit type (null ignored).public int getValueLocation()
public void setValueLocation(int location)
The location can be one of the constants: NONE, RIGHT and BULB.
location
- the location.
java.lang.IllegalArgumentException
- if the location code is not valid.public java.awt.Font getValueFont()
public void setValueFont(java.awt.Font f)
f
- the new font.public java.awt.Paint getValuePaint()
public void setValuePaint(java.awt.Paint p)
p
- the new paint.public void setValueFormat(java.text.NumberFormat formatter)
formatter
- the new formatter.public java.awt.Paint getMercuryPaint()
public void setMercuryPaint(java.awt.Paint paint)
paint
- the new paint.public boolean getShowValueLines()
public void setShowValueLines(boolean b)
b
- Whether to show value lines in the thermometerpublic void setSubrangeInfo(int range, double low, double hi)
range
- the range to specify information about.low
- the low value for the rangehi
- the high value for the rangepublic void setSubrangeInfo(int range, double rangeLow, double rangeHigh, double displayLow, double displayHigh)
range
- the new rangeInfo value.rangeLow
- the new rangeInfo valuerangeHigh
- the new rangeInfo valuedisplayLow
- the new rangeInfo valuedisplayHigh
- the new rangeInfo valuepublic void setSubrange(int range, double low, double high)
range
- the range type.low
- the low value.high
- the high value.public void setDisplayRange(int range, double low, double high)
range
- the range type.low
- the low value.high
- the high value.public java.awt.Paint getSubrangePaint(int range)
range
- the range.
public void setSubrangePaint(int range, java.awt.Paint paint)
range
- the range.paint
- the paint to be applied.public boolean getFollowDataInSubranges()
public void setFollowDataInSubranges(boolean flag)
flag
- the flag.public boolean getUseSubrangePaint()
public void setUseSubrangePaint(boolean flag)
flag
- The new range colour change optionpublic void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, ChartRenderingInfo info)
draw
in class Plot
g2
- the graphics device.plotArea
- the area within which the plot should be drawn.info
- collects info about the drawing.public void zoom(double percent)
Plots are required to support the zoom operation. In the case of a thermometer chart, it doesn't make sense to zoom in or out, so the method is empty.
zoom
in class Plot
percent
- the zoom percentage.public java.lang.String getPlotType()
getPlotType
in class Plot
public void datasetChanged(DatasetChangeEvent event)
datasetChanged
in interface DatasetChangeListener
datasetChanged
in class Plot
event
- the dataset change event.public java.lang.Number getMinimumVerticalDataValue()
public java.lang.Number getMaximumVerticalDataValue()
public Range getVerticalDataRange(ValueAxis axis)
getVerticalDataRange
in interface VerticalValuePlot
axis
- the axis.
public boolean isCompatibleHorizontalAxis(Axis axis)
axis
- the axis.
public boolean isCompatibleVerticalAxis(Axis axis)
axis
- the axis.
public void propertyChange()
protected void setAxisRange()
public java.util.List getLegendItemLabels()
public LegendItemCollection getLegendItems()
getLegendItems
in class Plot
public boolean isCompatibleRangeAxis(ValueAxis axis)
axis
- The proposed axis.
true
if the axis is compatible with the plot.public ValueAxis getVerticalValueAxis()
This is required by the VerticalValuePlot interface, but not used in this class.
getVerticalValueAxis
in interface VerticalValuePlot
protected static boolean isValidNumber(double d)
d
- the number to be tested.
public boolean equals(java.lang.Object obj)
equals
in class Plot
obj
- the object.
true
or false
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |