Package org.jfree.chart.plot.dial
Class DialPlot
java.lang.Object
org.jfree.chart.plot.Plot
org.jfree.chart.plot.dial.DialPlot
- All Implemented Interfaces:
Serializable,Cloneable,EventListener,AnnotationChangeListener,AxisChangeListener,MarkerChangeListener,LegendItemSource,DialLayerChangeListener,PublicCloneable,DatasetChangeListener
A dial plot composed of user-definable layers.
The example shown here is generated by the

DialDemo2.java
program included in the JFreeChart Demo Collection:

- See Also:
-
Field Summary
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
ConstructorsConstructorDescriptionDialPlot()Creates a new instance ofDialPlot.DialPlot(ValueDataset dataset) Creates a new instance ofDialPlot. -
Method Summary
Modifier and TypeMethodDescriptionvoidAdds a layer to the plot and sends aPlotChangeEventto all registered listeners.voidaddPointer(DialPointer pointer) Adds a pointer to the plot and sends aPlotChangeEventto all registered listeners.voidAdds a dial scale to the plot and sends aPlotChangeEventto all registered listeners.voidReceives notification when a layer has changed, and responds by forwarding aPlotChangeEventto all registered listeners.voiddraw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) Draws the plot.booleanTests thisDialPlotinstance for equality with an arbitrary object.Returns the background.getCap()Returns the cap.Returns the primary dataset for the plot.getDataset(int index) Returns the dataset at the given index.intReturns the number of datasets.Returns the dial's frame.intgetLayerIndex(DialLayer layer) Returns the index for the specified layer.Returns the plot type.getPointerForDataset(int datasetIndex) Returns the dial pointer that is associated with the specified dataset, ornull.intgetPointerIndex(DialPointer pointer) Returns the index for the specified pointer.getScale(int index) Returns the scale at the given index.getScaleForDataset(int datasetIndex) Returns the dial scale for a specific dataset.doublegetValue(int datasetIndex) Returns the value from the specified dataset.doubleReturns the height of the viewing rectangle.doubleReturns the width of the viewing rectangle.doublegetViewX()Returns the x-coordinate of the viewing rectangle.doublegetViewY()Returns the y-coordinate of the viewing rectangle.inthashCode()Returns a hash code for this instance.voidmapDatasetToScale(int index, int scaleIndex) Maps a dataset to a particular scale.static Rectangle2DrectangleByRadius(Rectangle2D rect, double radiusW, double radiusH) A utility method that computes a rectangle using relative radius values.voidremoveLayer(int index) Removes the layer at the specified index and sends aPlotChangeEventto all registered listeners.voidremoveLayer(DialLayer layer) Removes the specified layer and sends aPlotChangeEventto all registered listeners.voidremovePointer(int index) Removes the pointer at the specified index and sends aPlotChangeEventto all registered listeners.voidremovePointer(DialPointer pointer) Removes the specified pointer and sends aPlotChangeEventto all registered listeners.voidsetBackground(DialLayer background) Sets the background layer and sends aPlotChangeEventto all registered listeners.voidSets the cap and sends aPlotChangeEventto all registered listeners.voidsetDataset(int index, ValueDataset dataset) Sets a dataset for the plot.voidsetDataset(ValueDataset dataset) Sets the dataset for the plot, replacing the existing dataset, if there is one, and sends aPlotChangeEventto all registered listeners.voidsetDialFrame(DialFrame frame) Sets the dial's frame and sends aPlotChangeEventto all registered listeners.voidsetView(double x, double y, double w, double h) Sets the viewing rectangle, relative to the dial's framing rectangle, and sends aPlotChangeEventto all registered listeners.Methods inherited from class org.jfree.chart.plot.Plot
addChangeListener, annotationChanged, axisChanged, canEqual, clone, createAndAddEntity, datasetChanged, drawBackground, drawBackgroundImage, drawNoDataMessage, drawOutline, fetchElementHintingFlag, fillBackground, fillBackground, fireChangeEvent, getBackgroundAlpha, getBackgroundImage, getBackgroundImageAlignment, getBackgroundImageAlpha, getBackgroundPaint, getChart, 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, setChart, setDatasetGroup, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setNotify, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParent, zoom
-
Constructor Details
-
DialPlot
public DialPlot()Creates a new instance ofDialPlot. -
DialPlot
Creates a new instance ofDialPlot.- Parameters:
dataset- the dataset (nullpermitted).
-
-
Method Details
-
getBackground
Returns the background.- Returns:
- The background (possibly
null). - See Also:
-
setBackground
Sets the background layer and sends aPlotChangeEventto all registered listeners.- Parameters:
background- the background layer (nullpermitted).- See Also:
-
getCap
Returns the cap.- Returns:
- The cap (possibly
null). - See Also:
-
setCap
Sets the cap and sends aPlotChangeEventto all registered listeners.- Parameters:
cap- the cap (nullpermitted).- See Also:
-
getDialFrame
Returns the dial's frame.- Returns:
- The dial's frame (never
null). - See Also:
-
setDialFrame
Sets the dial's frame and sends aPlotChangeEventto all registered listeners.- Parameters:
frame- the frame (nullnot permitted).- See Also:
-
getViewX
Returns the x-coordinate of the viewing rectangle. This is specified in the range 0.0 to 1.0, relative to the dial's framing rectangle.- Returns:
- The x-coordinate of the viewing rectangle.
- See Also:
-
getViewY
Returns the y-coordinate of the viewing rectangle. This is specified in the range 0.0 to 1.0, relative to the dial's framing rectangle.- Returns:
- The y-coordinate of the viewing rectangle.
- See Also:
-
getViewWidth
Returns the width of the viewing rectangle. This is specified in the range 0.0 to 1.0, relative to the dial's framing rectangle.- Returns:
- The width of the viewing rectangle.
- See Also:
-
getViewHeight
Returns the height of the viewing rectangle. This is specified in the range 0.0 to 1.0, relative to the dial's framing rectangle.- Returns:
- The height of the viewing rectangle.
- See Also:
-
setView
Sets the viewing rectangle, relative to the dial's framing rectangle, and sends aPlotChangeEventto all registered listeners.- Parameters:
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).- See Also:
-
addLayer
Adds a layer to the plot and sends aPlotChangeEventto all registered listeners.- Parameters:
layer- the layer (nullnot permitted).
-
getLayerIndex
Returns the index for the specified layer.- Parameters:
layer- the layer (nullnot permitted).- Returns:
- The layer index.
-
removeLayer
Removes the layer at the specified index and sends aPlotChangeEventto all registered listeners.- Parameters:
index- the index.
-
removeLayer
Removes the specified layer and sends aPlotChangeEventto all registered listeners.- Parameters:
layer- the layer (nullnot permitted).
-
addPointer
Adds a pointer to the plot and sends aPlotChangeEventto all registered listeners.- Parameters:
pointer- the pointer (nullnot permitted).
-
getPointerIndex
Returns the index for the specified pointer.- Parameters:
pointer- the pointer (nullnot permitted).- Returns:
- The pointer index.
-
removePointer
Removes the pointer at the specified index and sends aPlotChangeEventto all registered listeners.- Parameters:
index- the index.
-
removePointer
Removes the specified pointer and sends aPlotChangeEventto all registered listeners.- Parameters:
pointer- the pointer (nullnot permitted).
-
getPointerForDataset
Returns the dial pointer that is associated with the specified dataset, ornull.- Parameters:
datasetIndex- the dataset index.- Returns:
- The pointer.
-
getDataset
Returns the primary dataset for the plot.- Returns:
- The primary dataset (possibly
null).
-
getDataset
Returns the dataset at the given index.- Parameters:
index- the dataset index.- Returns:
- The dataset (possibly
null).
-
setDataset
Sets the dataset for the plot, replacing the existing dataset, if there is one, and sends aPlotChangeEventto all registered listeners.- Parameters:
dataset- the dataset (nullpermitted).
-
setDataset
Sets a dataset for the plot.- Parameters:
index- the dataset index.dataset- the dataset (nullpermitted).
-
getDatasetCount
Returns the number of datasets.- Returns:
- The number of datasets.
-
draw
public void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info) Draws the plot. This method is usually called by theJFreeChartinstance that manages the plot.- Specified by:
drawin classPlot- Parameters:
g2- 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,nullis permitted).parentState- the state for the parent plot (if any).info- used to collect plot rendering info (nullpermitted).
-
getValue
Returns the value from the specified dataset.- Parameters:
datasetIndex- the dataset index.- Returns:
- The data value.
-
addScale
Adds a dial scale to the plot and sends aPlotChangeEventto all registered listeners.- Parameters:
index- the scale index.scale- the scale (nullnot permitted).
-
getScale
Returns the scale at the given index.- Parameters:
index- the scale index.- Returns:
- The scale (possibly
null).
-
mapDatasetToScale
Maps a dataset to a particular scale.- Parameters:
index- the dataset index (zero-based).scaleIndex- the scale index (zero-based).
-
getScaleForDataset
Returns the dial scale for a specific dataset.- Parameters:
datasetIndex- the dataset index.- Returns:
- The dial scale.
-
rectangleByRadius
A utility method that computes a rectangle using relative radius values.- Parameters:
rect- the reference rectangle (nullnot permitted).radiusW- the width radius (must be > 0.0)radiusH- the height radius.- Returns:
- A new rectangle.
-
dialLayerChanged
Receives notification when a layer has changed, and responds by forwarding aPlotChangeEventto all registered listeners.- Specified by:
dialLayerChangedin interfaceDialLayerChangeListener- Parameters:
event- the event.
-
equals
Tests thisDialPlotinstance for equality with an arbitrary object. The plot's dataset(s) is (are) not included in the test. -
hashCode
Returns a hash code for this instance. -
getPlotType
Returns the plot type.- Specified by:
getPlotTypein classPlot- Returns:
"DialPlot"
-