public class ThermometerPlot extends Plot implements ValueAxisPlot, Zoomable, java.lang.Cloneable, java.io.Serializable
ValueDataset
) in a
thermometer type display.
This plot supports a number of options:
Modifier and Type | Field and Description |
---|---|
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
Deprecated.
As of 1.0.7, use
getBulbDiameter() . |
protected static int |
BULB_RADIUS
Deprecated.
As of 1.0.7, use
getBulbRadius() . |
protected static int |
COLUMN_DIAMETER
Deprecated.
As of 1.0.7, use
getColumnDiameter() . |
protected static int |
COLUMN_RADIUS
Deprecated.
As of 1.0.7, use
getColumnRadius() . |
static int |
CRITICAL
A constant for the 'critical' range.
|
protected static int |
DEFAULT_BULB_RADIUS
The default bulb radius.
|
protected static int |
DEFAULT_COLUMN_RADIUS
The default column radius.
|
protected static int |
DEFAULT_GAP
The default gap between the outlines representing the thermometer.
|
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
Deprecated.
As of 1.0.7, use
getGap() times two. |
protected static int |
GAP_RADIUS
Deprecated.
As of 1.0.7, use
getGap() . |
static int |
LEFT
A constant for the value label position (left of the thermometer).
|
protected static java.util.ResourceBundle |
localizationResources
The resourceBundle for the localization.
|
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.
|
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 and Description |
---|
ThermometerPlot()
Creates a new thermometer plot.
|
ThermometerPlot(ValueDataset dataset)
Creates a new thermometer plot, using default attributes where necessary.
|
Modifier and Type | Method and Description |
---|---|
java.lang.Object |
clone()
Returns a clone of the plot.
|
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 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).
|
boolean |
equals(java.lang.Object obj)
Tests this plot for equality with another object.
|
int |
getAxisLocation()
Returns the axis location.
|
int |
getBulbDiameter()
Returns the bulb diameter, which is always twice the value returned
by
getBulbRadius() . |
int |
getBulbRadius()
Returns the bulb radius, in Java2D units.
|
int |
getColumnDiameter()
Returns the column diameter, which is always twice the value returned
by
getColumnRadius() . |
int |
getColumnRadius()
Returns the column radius, in Java2D units.
|
Range |
getDataRange(ValueAxis axis)
Returns the data range.
|
ValueDataset |
getDataset()
Returns the dataset for the plot.
|
boolean |
getFollowDataInSubranges()
Returns a flag that controls whether or not the thermometer axis zooms
to display the subrange within which the data value falls.
|
int |
getGap()
Returns the gap, in Java2D units, between the two outlines that
represent the thermometer.
|
LegendItemCollection |
getLegendItems()
Returns the legend items for the plot.
|
double |
getLowerBound()
Returns the lower bound for the thermometer.
|
java.lang.Number |
getMaximumVerticalDataValue()
Deprecated.
This method is not used. Officially deprecated in version
1.0.6.
|
java.awt.Paint |
getMercuryPaint()
Returns the default mercury paint.
|
java.lang.Number |
getMinimumVerticalDataValue()
Deprecated.
This method is not used. Officially deprecated in version
1.0.6.
|
PlotOrientation |
getOrientation()
Returns the orientation of the plot.
|
org.jfree.ui.RectangleInsets |
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()
Deprecated.
This flag doesn't do anything useful/visible. Deprecated
as of version 1.0.6.
|
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 a code indicating the unit display type.
|
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 a code indicating the location at which the value label is
displayed.
|
java.awt.Paint |
getValuePaint()
Gets the paint used to display the current value.
|
boolean |
isDomainZoomable()
Returns
false . |
boolean |
isRangeZoomable()
Returns
true . |
protected static boolean |
isValidNumber(double d)
Determine whether a number is valid and finite.
|
void |
setAxisLocation(int location)
Sets the location at which the axis is displayed relative to the
thermometer, and sends a
PlotChangeEvent to all registered
listeners. |
protected void |
setAxisRange()
Sets the axis range to the current values in the rangeInfo array.
|
void |
setBulbRadius(int r)
Sets the bulb radius (in Java2D units) and sends a
PlotChangeEvent to all registered listeners. |
void |
setColumnRadius(int r)
Sets the column radius (in Java2D units) and sends a
PlotChangeEvent to all registered listeners. |
void |
setDataset(ValueDataset dataset)
Sets the dataset for the plot, replacing the existing dataset if there
is one, and sends a
PlotChangeEvent to all registered listeners. |
void |
setDisplayRange(int range,
double low,
double high)
Sets the displayed bounds for a sub 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 |
setGap(int gap)
Sets the gap (in Java2D units) between the two outlines that represent
the thermometer, and sends a
PlotChangeEvent to all registered
listeners. |
void |
setLowerBound(double lower)
Sets the lower bound for the thermometer.
|
void |
setMercuryPaint(java.awt.Paint paint)
Sets the default mercury paint and sends a
PlotChangeEvent to
all registered listeners. |
void |
setPadding(org.jfree.ui.RectangleInsets padding)
Sets the padding for the thermometer and sends a
PlotChangeEvent
to all registered listeners. |
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 and sends a
PlotChangeEvent to
all registered listeners. |
void |
setShowValueLines(boolean b)
Deprecated.
This flag doesn't do anything useful/visible. Deprecated
as of version 1.0.6.
|
void |
setSubrange(int range,
double low,
double high)
Sets the bounds for a subrange.
|
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 subrange and sends a
PlotChangeEvent to all registered listeners. |
void |
setThermometerPaint(java.awt.Paint paint)
Sets the paint used to draw the thermometer outline and sends a
PlotChangeEvent to all registered listeners. |
void |
setThermometerStroke(java.awt.Stroke s)
Sets the stroke used to draw the thermometer outline and sends a
PlotChangeEvent to all registered listeners. |
void |
setUnits(int u)
Sets the units to be displayed in the thermometer.
|
void |
setUnits(java.lang.String u)
Deprecated.
Use setUnits(int) instead. Deprecated as of version 1.0.6,
because this method is a little obscure and redundant anyway.
|
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 and sends a
PlotChangeEvent to all registered listeners. |
void |
setValueLocation(int location)
Sets the location at which the current value is displayed and sends a
PlotChangeEvent to all registered listeners. |
void |
setValuePaint(java.awt.Paint paint)
Sets the paint used to display the current value and sends a
PlotChangeEvent to all registered listeners. |
void |
zoom(double percent)
A zoom method that does nothing.
|
void |
zoomDomainAxes(double lowerPercent,
double upperPercent,
PlotRenderingInfo state,
java.awt.geom.Point2D source)
This method does nothing.
|
void |
zoomDomainAxes(double factor,
PlotRenderingInfo state,
java.awt.geom.Point2D source)
Multiplies the range on the domain axis/axes by the specified factor.
|
void |
zoomDomainAxes(double factor,
PlotRenderingInfo state,
java.awt.geom.Point2D source,
boolean useAnchor)
Multiplies the range on the domain axis/axes by the specified factor.
|
void |
zoomRangeAxes(double lowerPercent,
double upperPercent,
PlotRenderingInfo state,
java.awt.geom.Point2D source)
Zooms the range axes.
|
void |
zoomRangeAxes(double factor,
PlotRenderingInfo state,
java.awt.geom.Point2D source)
Multiplies the range on the range axis/axes by the specified factor.
|
void |
zoomRangeAxes(double factor,
PlotRenderingInfo state,
java.awt.geom.Point2D source,
boolean useAnchor)
Multiplies the range on the range axis/axes by the specified factor.
|
addChangeListener, annotationChanged, axisChanged, createAndAddEntity, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fillBackground, fillBackground, fireChangeEvent, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getNoDataMessage, getNoDataMessageFont, getNoDataMessagePaint, getOutlinePaint, getOutlineStroke, getParent, getRectX, getRectY, getRootPlot, handleClick, isNotify, isOutlineVisible, isSubplot, markerChanged, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setDatasetGroup, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setNotify, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParent
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 LEFT
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
getBulbRadius()
.protected static final int BULB_DIAMETER
getBulbDiameter()
.protected static final int COLUMN_RADIUS
getColumnRadius()
.protected static final int COLUMN_DIAMETER
getColumnDiameter()
.protected static final int GAP_RADIUS
getGap()
.protected static final int GAP_DIAMETER
getGap()
times two.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
protected static final int DEFAULT_BULB_RADIUS
protected static final int DEFAULT_COLUMN_RADIUS
protected static final int DEFAULT_GAP
protected static java.util.ResourceBundle localizationResources
public ThermometerPlot()
public ThermometerPlot(ValueDataset dataset)
dataset
- the data set.public ValueDataset getDataset()
null
).setDataset(ValueDataset)
public void setDataset(ValueDataset dataset)
PlotChangeEvent
to all registered listeners.dataset
- the dataset (null
permitted).getDataset()
public ValueAxis getRangeAxis()
null
).setRangeAxis(ValueAxis)
public void setRangeAxis(ValueAxis axis)
PlotChangeEvent
to
all registered listeners.axis
- the new axis (null
not permitted).getRangeAxis()
public double getLowerBound()
setLowerBound(double)
public void setLowerBound(double lower)
lower
- the lower bound.getLowerBound()
public double getUpperBound()
setUpperBound(double)
public void setUpperBound(double upper)
upper
- the upper bound.getUpperBound()
public void setRange(double lower, double upper)
lower
- the lower bound.upper
- the upper bound.public org.jfree.ui.RectangleInsets getPadding()
null
).setPadding(RectangleInsets)
public void setPadding(org.jfree.ui.RectangleInsets padding)
PlotChangeEvent
to all registered listeners.padding
- the padding (null
not permitted).getPadding()
public java.awt.Stroke getThermometerStroke()
null
).setThermometerStroke(Stroke)
,
getThermometerPaint()
public void setThermometerStroke(java.awt.Stroke s)
PlotChangeEvent
to all registered listeners.s
- the new stroke (null
ignored).getThermometerStroke()
public java.awt.Paint getThermometerPaint()
null
).setThermometerPaint(Paint)
,
getThermometerStroke()
public void setThermometerPaint(java.awt.Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the new paint (null
ignored).getThermometerPaint()
public int getUnits()
UNITS_NONE
, UNITS_FAHRENHEIT
, UNITS_CELCIUS
and UNITS_KELVIN
.setUnits(int)
public void setUnits(int u)
u
- the new unit type.getUnits()
public void setUnits(java.lang.String u)
u
- the unit type (null
ignored).public int getValueLocation()
public void setValueLocation(int location)
PlotChangeEvent
to all registered listeners.
The location can be one of the constants:
NONE
,
RIGHT
LEFT
and
BULB
.
location
- the location.public int getAxisLocation()
NONE
, LEFT
and
RIGHT
).setAxisLocation(int)
public void setAxisLocation(int location)
PlotChangeEvent
to all registered
listeners.location
- the location (one of NONE
, LEFT
and
RIGHT
).getAxisLocation()
public java.awt.Font getValueFont()
setValueFont(Font)
public void setValueFont(java.awt.Font f)
f
- the new font (null
not permitted).getValueFont()
public java.awt.Paint getValuePaint()
setValuePaint(Paint)
public void setValuePaint(java.awt.Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the new paint (null
not permitted).getValuePaint()
public void setValueFormat(java.text.NumberFormat formatter)
PlotChangeEvent
to all registered listeners.formatter
- the new formatter (null
not permitted).public java.awt.Paint getMercuryPaint()
null
).setMercuryPaint(Paint)
public void setMercuryPaint(java.awt.Paint paint)
PlotChangeEvent
to
all registered listeners.paint
- the new paint (null
not permitted).getMercuryPaint()
public boolean getShowValueLines()
setShowValueLines(boolean)
public void setShowValueLines(boolean b)
b
- Whether to show value lines in the thermometergetShowValueLines()
public 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 (.setSubrangePaint(int, Paint)
public void setSubrangePaint(int range, java.awt.Paint paint)
PlotChangeEvent
to all registered listeners.range
- the range (0, 1 or 2).paint
- the paint to be applied (null
not permitted).getSubrangePaint(int)
public boolean getFollowDataInSubranges()
public void setFollowDataInSubranges(boolean flag)
flag
- the flag.public boolean getUseSubrangePaint()
setUseSubrangePaint(boolean)
public void setUseSubrangePaint(boolean flag)
flag
- the new range colour change optiongetUseSubrangePaint()
public int getBulbRadius()
public void setBulbRadius(int r)
PlotChangeEvent
to all registered listeners.r
- the new radius (in Java2D units).getBulbRadius()
public int getBulbDiameter()
getBulbRadius()
.public int getColumnRadius()
setColumnRadius(int)
public void setColumnRadius(int r)
PlotChangeEvent
to all registered listeners.r
- the new radius.getColumnRadius()
public int getColumnDiameter()
getColumnRadius()
.public int getGap()
setGap(int)
public void setGap(int gap)
PlotChangeEvent
to all registered
listeners.gap
- the new gap.getGap()
public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.awt.geom.Point2D anchor, PlotState parentState, PlotRenderingInfo info)
public void zoom(double percent)
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 getDataRange(ValueAxis axis)
getDataRange
in interface ValueAxisPlot
axis
- the axis.protected void setAxisRange()
public LegendItemCollection getLegendItems()
getLegendItems
in interface LegendItemSource
getLegendItems
in class Plot
null
.public PlotOrientation getOrientation()
getOrientation
in interface Zoomable
PlotOrientation.VERTICAL
).protected static boolean isValidNumber(double d)
d
- the number to be tested.true
if the number is valid and finite, and
false
otherwise.public boolean equals(java.lang.Object obj)
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
public void zoomDomainAxes(double factor, PlotRenderingInfo state, java.awt.geom.Point2D source)
zoomDomainAxes
in interface Zoomable
factor
- the zoom factor.state
- the plot state.source
- the source point.Zoomable.zoomRangeAxes(double, PlotRenderingInfo, Point2D)
public void zoomDomainAxes(double factor, PlotRenderingInfo state, java.awt.geom.Point2D source, boolean useAnchor)
zoomDomainAxes
in interface Zoomable
factor
- the zoom factor.state
- the plot state.source
- the source point.useAnchor
- a flag that controls whether or not the source point
is used for the zoom anchor.Zoomable.zoomRangeAxes(double, PlotRenderingInfo, Point2D, boolean)
public void zoomRangeAxes(double factor, PlotRenderingInfo state, java.awt.geom.Point2D source)
zoomRangeAxes
in interface Zoomable
factor
- the zoom factor.state
- the plot state.source
- the source point.Zoomable.zoomDomainAxes(double, PlotRenderingInfo, Point2D)
public void zoomRangeAxes(double factor, PlotRenderingInfo state, java.awt.geom.Point2D source, boolean useAnchor)
zoomRangeAxes
in interface Zoomable
factor
- the zoom factor.state
- the plot state.source
- the source point.useAnchor
- a flag that controls whether or not the source point
is used for the zoom anchor.Zoomable.zoomDomainAxes(double, PlotRenderingInfo, Point2D)
public void zoomDomainAxes(double lowerPercent, double upperPercent, PlotRenderingInfo state, java.awt.geom.Point2D source)
zoomDomainAxes
in interface Zoomable
lowerPercent
- the lower percent.upperPercent
- the upper percent.state
- the plot state.source
- the source point.Zoomable.zoomRangeAxes(double, double, PlotRenderingInfo, Point2D)
public void zoomRangeAxes(double lowerPercent, double upperPercent, PlotRenderingInfo state, java.awt.geom.Point2D source)
zoomRangeAxes
in interface Zoomable
lowerPercent
- the lower percent.upperPercent
- the upper percent.state
- the plot state.source
- the source point.Zoomable.zoomDomainAxes(double, double, PlotRenderingInfo, Point2D)
public boolean isDomainZoomable()
false
.isDomainZoomable
in interface Zoomable
Zoomable.isRangeZoomable()
public boolean isRangeZoomable()
true
.isRangeZoomable
in interface Zoomable
Zoomable.isDomainZoomable()