public class DialPlot extends Plot implements DialLayerChangeListener
DialDemo2.java
program included in the JFreeChart Demo Collection:

| Modifier and Type | Field and Description |
|---|---|
private DialLayer |
background
The background layer (optional).
|
private DialLayer |
cap
The needle cap (optional).
|
private org.jfree.util.ObjectList |
datasets
The dataset(s) for the dial plot.
|
private org.jfree.util.ObjectList |
datasetToScaleMap
Storage for keys that map datasets to scales.
|
private DialFrame |
dialFrame
The dial frame.
|
private java.util.List |
layers
The drawing layers for the dial plot.
|
private java.util.List |
pointers
The pointer(s) for the dial.
|
private org.jfree.util.ObjectList |
scales
The scale(s) for the dial plot.
|
private double |
viewH
The height of the view window, expressed as a percentage.
|
private double |
viewW
The width of the view window, expressed as a percentage.
|
private double |
viewX
The x-coordinate for the view window.
|
private double |
viewY
The y-coordinate for the view window.
|
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 |
|---|
DialPlot()
Creates a new instance of
DialPlot. |
DialPlot(ValueDataset dataset)
Creates a new instance of
DialPlot. |
| Modifier and Type | Method and Description |
|---|---|
void |
addLayer(DialLayer layer)
Adds a layer to the plot and sends a
PlotChangeEvent to all
registered listeners. |
void |
addPointer(DialPointer pointer)
Adds a pointer to the plot and sends a
PlotChangeEvent to all
registered listeners. |
void |
addScale(int index,
DialScale scale)
Adds a dial scale to the plot and sends a
PlotChangeEvent to
all registered listeners. |
void |
dialLayerChanged(DialLayerChangeEvent event)
Receives notification when a layer has changed, and responds by
forwarding a
PlotChangeEvent to all registered listeners. |
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area,
java.awt.geom.Point2D anchor,
PlotState parentState,
PlotRenderingInfo info)
Draws the plot.
|
boolean |
equals(java.lang.Object obj)
Tests this
DialPlot instance for equality with an
arbitrary object. |
DialLayer |
getBackground()
Returns the background.
|
DialLayer |
getCap()
Returns the cap.
|
ValueDataset |
getDataset()
Returns the primary dataset for the plot.
|
ValueDataset |
getDataset(int index)
Returns the dataset at the given index.
|
int |
getDatasetCount()
Returns the number of datasets.
|
DialFrame |
getDialFrame()
Returns the dial's frame.
|
int |
getLayerIndex(DialLayer layer)
Returns the index for the specified layer.
|
java.lang.String |
getPlotType()
Returns the plot type.
|
DialPointer |
getPointerForDataset(int datasetIndex)
Returns the dial pointer that is associated with the specified
dataset, or
null. |
int |
getPointerIndex(DialPointer pointer)
Returns the index for the specified pointer.
|
DialScale |
getScale(int index)
Returns the scale at the given index.
|
DialScale |
getScaleForDataset(int datasetIndex)
Returns the dial scale for a specific dataset.
|
double |
getValue(int datasetIndex)
Returns the value from the specified dataset.
|
double |
getViewHeight()
Returns the height of the viewing rectangle.
|
double |
getViewWidth()
Returns the width of the viewing rectangle.
|
double |
getViewX()
Returns the x-coordinate of the viewing rectangle.
|
double |
getViewY()
Returns the y-coordinate of the viewing rectangle.
|
int |
hashCode()
Returns a hash code for this instance.
|
void |
mapDatasetToScale(int index,
int scaleIndex)
Maps a dataset to a particular scale.
|
private void |
readObject(java.io.ObjectInputStream stream)
Provides serialization support.
|
static java.awt.geom.Rectangle2D |
rectangleByRadius(java.awt.geom.Rectangle2D rect,
double radiusW,
double radiusH)
A utility method that computes a rectangle using relative radius values.
|
void |
removeLayer(DialLayer layer)
Removes the specified layer and sends a
PlotChangeEvent to all
registered listeners. |
void |
removeLayer(int index)
Removes the layer at the specified index and sends a
PlotChangeEvent to all registered listeners. |
void |
removePointer(DialPointer pointer)
Removes the specified pointer and sends a
PlotChangeEvent to all
registered listeners. |
void |
removePointer(int index)
Removes the pointer at the specified index and sends a
PlotChangeEvent to all registered listeners. |
void |
setBackground(DialLayer background)
Sets the background layer and sends a
PlotChangeEvent to all
registered listeners. |
void |
setCap(DialLayer cap)
Sets the cap and sends a
PlotChangeEvent to all registered
listeners. |
void |
setDataset(int index,
ValueDataset dataset)
Sets a dataset for the plot.
|
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 |
setDialFrame(DialFrame frame)
Sets the dial's frame and sends a
PlotChangeEvent to all
registered listeners. |
void |
setView(double x,
double y,
double w,
double h)
Sets the viewing rectangle, relative to the dial's framing rectangle,
and sends a
PlotChangeEvent to all registered listeners. |
private java.awt.geom.Rectangle2D |
viewToFrame(java.awt.geom.Rectangle2D view)
Returns the frame surrounding the specified view rectangle.
|
private void |
writeObject(java.io.ObjectOutputStream stream)
Provides serialization support.
|
addChangeListener, annotationChanged, axisChanged, clone, createAndAddEntity, datasetChanged, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fillBackground, fillBackground, fireChangeEvent, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getDatasetGroup, getDrawingSupplier, getForegroundAlpha, getInsets, getLegendItems, 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, zoomprivate DialLayer background
private DialLayer cap
private DialFrame dialFrame
private org.jfree.util.ObjectList datasets
private org.jfree.util.ObjectList scales
private org.jfree.util.ObjectList datasetToScaleMap
private java.util.List layers
private java.util.List pointers
private double viewX
private double viewY
private double viewW
private double viewH
public DialPlot()
DialPlot.public DialPlot(ValueDataset dataset)
DialPlot.dataset - the dataset (null permitted).public DialLayer getBackground()
null).setBackground(DialLayer)public void setBackground(DialLayer background)
PlotChangeEvent to all
registered listeners.background - the background layer (null permitted).getBackground()public DialLayer getCap()
null).setCap(DialLayer)public void setCap(DialLayer cap)
PlotChangeEvent to all registered
listeners.cap - the cap (null permitted).getCap()public DialFrame getDialFrame()
null).setDialFrame(DialFrame)public void setDialFrame(DialFrame frame)
PlotChangeEvent to all
registered listeners.frame - the frame (null not permitted).getDialFrame()public double getViewX()
setView(double, double, double, double)public double getViewY()
setView(double, double, double, double)public double getViewWidth()
setView(double, double, double, double)public double getViewHeight()
setView(double, double, double, double)public void setView(double x,
double y,
double w,
double h)
PlotChangeEvent to all registered listeners.x - the x-coordinate (in the range 0.0 to 1.0).y - the y-coordinate (in the range 0.0 to 1.0).w - the width (in the range 0.0 to 1.0).h - the height (in the range 0.0 to 1.0).getViewX(),
getViewY(),
getViewWidth(),
getViewHeight()public void addLayer(DialLayer layer)
PlotChangeEvent to all
registered listeners.layer - the layer (null not permitted).public int getLayerIndex(DialLayer layer)
layer - the layer (null not permitted).public void removeLayer(int index)
PlotChangeEvent to all registered listeners.index - the index.public void removeLayer(DialLayer layer)
PlotChangeEvent to all
registered listeners.layer - the layer (null not permitted).public void addPointer(DialPointer pointer)
PlotChangeEvent to all
registered listeners.pointer - the pointer (null not permitted).public int getPointerIndex(DialPointer pointer)
pointer - the pointer (null not permitted).public void removePointer(int index)
PlotChangeEvent to all registered listeners.index - the index.public void removePointer(DialPointer pointer)
PlotChangeEvent to all
registered listeners.pointer - the pointer (null not permitted).public DialPointer getPointerForDataset(int datasetIndex)
null.datasetIndex - the dataset index.public ValueDataset getDataset()
null).public ValueDataset getDataset(int index)
index - the dataset index.null).public void setDataset(ValueDataset dataset)
PlotChangeEvent to all registered
listeners.dataset - the dataset (null permitted).public void setDataset(int index,
ValueDataset dataset)
index - the dataset index.dataset - the dataset (null permitted).public int getDatasetCount()
public void draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area,
java.awt.geom.Point2D anchor,
PlotState parentState,
PlotRenderingInfo info)
JFreeChart
instance that manages the plot.draw in class Plotg2 - the graphics target.area - the area in which the plot should be drawn.anchor - the anchor point (typically the last point that the
mouse clicked on, null is permitted).parentState - the state for the parent plot (if any).info - used to collect plot rendering info (null
permitted).private java.awt.geom.Rectangle2D viewToFrame(java.awt.geom.Rectangle2D view)
view - the view rectangle (null not permitted).public double getValue(int datasetIndex)
datasetIndex - the dataset index.public void addScale(int index,
DialScale scale)
PlotChangeEvent to
all registered listeners.index - the scale index.scale - the scale (null not permitted).public DialScale getScale(int index)
index - the scale index.null).public void mapDatasetToScale(int index,
int scaleIndex)
index - the dataset index (zero-based).scaleIndex - the scale index (zero-based).public DialScale getScaleForDataset(int datasetIndex)
datasetIndex - the dataset index.public static java.awt.geom.Rectangle2D rectangleByRadius(java.awt.geom.Rectangle2D rect,
double radiusW,
double radiusH)
rect - the reference rectangle (null not permitted).radiusW - the width radius (must be > 0.0)radiusH - the height radius.public void dialLayerChanged(DialLayerChangeEvent event)
PlotChangeEvent to all registered listeners.dialLayerChanged in interface DialLayerChangeListenerevent - the event.public boolean equals(java.lang.Object obj)
DialPlot instance for equality with an
arbitrary object. The plot's dataset(s) is (are) not included in
the test.public int hashCode()
hashCode in class java.lang.Objectpublic java.lang.String getPlotType()
getPlotType in class Plot"DialPlot"private void writeObject(java.io.ObjectOutputStream stream)
throws java.io.IOException
stream - the output stream.java.io.IOException - if there is an I/O error.private void readObject(java.io.ObjectInputStream stream)
throws java.io.IOException,
java.lang.ClassNotFoundException
stream - the input stream.java.io.IOException - if there is an I/O error.java.lang.ClassNotFoundException - if there is a classpath problem.