public class CustomCompassPlot
extends org.jfree.chart.plot.Plot
implements java.lang.Cloneable, java.io.Serializable
ValueDataset.
Unfortunately, I had to cut-and-paste this class so that I could customize the drawing and fix the font bug (the orig doesn't have a customizable font)
| Modifier and Type | Field and Description |
|---|---|
static java.awt.Font |
DEFAULT_LABEL_FONT
The default label font.
|
protected java.lang.String |
east |
protected static java.util.ResourceBundle |
localizationResources
The resourceBundle for the localization.
|
static int |
NO_LABELS
A constant for the label type.
|
protected java.lang.String |
north
Names of the directions
|
protected double |
revolutionDistance
The count to complete one revolution.
|
protected java.lang.String |
south |
static int |
VALUE_LABELS
A constant for the label type.
|
protected java.lang.String |
west |
| Constructor and Description |
|---|
CustomCompassPlot()
Default constructor.
|
CustomCompassPlot(org.jfree.data.general.ValueDataset dataset)
Constructs a new compass plot.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addDataset(org.jfree.data.general.ValueDataset dataset)
Adds a dataset to the compass.
|
void |
addDataset(org.jfree.data.general.ValueDataset dataset,
org.jfree.chart.needle.MeterNeedle needle)
Adds a dataset to the compass.
|
java.lang.Object |
clone()
Returns a clone of the annotation.
|
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area,
java.awt.geom.Point2D anchor,
org.jfree.chart.plot.PlotState parentState,
org.jfree.chart.plot.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 an object for equality with this plot.
|
protected java.awt.Font |
getCompassFont(int radius)
Returns the font for the compass, adjusted for the size of the plot.
|
org.jfree.data.general.ValueDataset[] |
getDatasets()
Returns the dataset.
|
boolean |
getDrawBorder()
Returns a flag that controls whether or not a border is drawn.
|
java.awt.Font |
getLabelFont()
Returns the label font.
|
int |
getLabelType()
Returns the label type.
|
org.jfree.chart.LegendItemCollection |
getLegendItems()
Returns the legend items for the plot.
|
java.lang.String |
getPlotType()
Returns a short string describing the type of plot.
|
double |
getRevolutionDistance()
Gets the count to complete one revolution.
|
java.awt.Paint |
getRoseCenterPaint()
Returns the paint used to fill the inner background area of the compass.
|
java.awt.Paint |
getRoseHighlightPaint()
Returns the paint used to draw the circles, symbols and labels on the compass.
|
java.awt.Paint |
getRosePaint()
Returns the paint used to fill the outer circle of the compass.
|
void |
setDrawBorder(boolean status)
Sets a flag that controls whether or not a border is drawn.
|
void |
setLabelFont(java.awt.Font font)
Sets the label font and sends a
PlotChangeEvent to all registered listeners. |
void |
setLabelType(int type)
Sets the label type (either
NO_LABELS or VALUE_LABELS. |
void |
setRevolutionDistance(double size)
Sets the count to complete one revolution.
|
void |
setRoseCenterPaint(java.awt.Paint paint)
Sets the paint used to fill the inner background area of the compass, and sends a
PlotChangeEvent to all
registered listeners. |
void |
setRoseHighlightPaint(java.awt.Paint paint)
Sets the paint used to draw the circles, symbols and labels of the compass, and sends a
PlotChangeEvent
to
all registered listeners. |
void |
setRosePaint(java.awt.Paint paint)
Sets the paint used to fill the outer circle of the compass, and sends a
PlotChangeEvent to all
registered
listeners. |
void |
setSeriesNeedle(int type)
Sets the needle type.
|
void |
setSeriesNeedle(int index,
int type)
Sets the needle for a series.
|
void |
setSeriesNeedle(int index,
org.jfree.chart.needle.MeterNeedle needle)
Sets the needle for a series.
|
void |
setSeriesOutlinePaint(int series,
java.awt.Paint p)
Sets the series outline paint.
|
void |
setSeriesOutlineStroke(int series,
java.awt.Stroke stroke)
Sets the series outline stroke.
|
void |
setSeriesPaint(int series,
java.awt.Paint paint)
Sets the series paint.
|
void |
updateCardinalStrings(java.lang.String north,
java.lang.String south,
java.lang.String east,
java.lang.String west)
Updates the strings for the compass directions.
|
void |
zoom(double percent)
No zooming is implemented for compass plot, so this method is empty.
|
addChangeListener, axisChanged, datasetChanged, 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, isOutlineVisible, isSubplot, markerChanged, notifyListeners, removeChangeListener, resolveDomainAxisLocation, resolveRangeAxisLocation, setBackgroundAlpha, setBackgroundImage, setBackgroundImageAlignment, setBackgroundImageAlpha, setBackgroundPaint, setDatasetGroup, setDrawingSupplier, setDrawingSupplier, setForegroundAlpha, setInsets, setInsets, setNoDataMessage, setNoDataMessageFont, setNoDataMessagePaint, setOutlinePaint, setOutlineStroke, setOutlineVisible, setParentpublic static final java.awt.Font DEFAULT_LABEL_FONT
public static final int NO_LABELS
public static final int VALUE_LABELS
protected static java.util.ResourceBundle localizationResources
protected double revolutionDistance
protected java.lang.String north
protected java.lang.String south
protected java.lang.String east
protected java.lang.String west
public CustomCompassPlot()
public CustomCompassPlot(org.jfree.data.general.ValueDataset dataset)
dataset - the dataset for the plot (null permitted).public int getLabelType()
NO_LABELS and VALUE_LABELS.public void setLabelType(int type)
NO_LABELS or VALUE_LABELS.type - the type.public java.awt.Font getLabelFont()
public void setLabelFont(java.awt.Font font)
PlotChangeEvent to all registered listeners.font - the new label font.public java.awt.Paint getRosePaint()
null).public void setRosePaint(java.awt.Paint paint)
PlotChangeEvent to all
registered
listeners.paint - the paint (null not permitted).public java.awt.Paint getRoseCenterPaint()
null).public void setRoseCenterPaint(java.awt.Paint paint)
PlotChangeEvent to all
registered listeners.paint - the paint (null not permitted).public java.awt.Paint getRoseHighlightPaint()
null).public void setRoseHighlightPaint(java.awt.Paint paint)
PlotChangeEvent
to
all registered listeners.paint - the paint (null not permitted).public boolean getDrawBorder()
public void setDrawBorder(boolean status)
status - the flag status.public void setSeriesPaint(int series,
java.awt.Paint paint)
series - the series index.paint - the paint.public void setSeriesOutlinePaint(int series,
java.awt.Paint p)
series - the series index.p - the paint.public void setSeriesOutlineStroke(int series,
java.awt.Stroke stroke)
series - the series index.stroke - the stroke.public void setSeriesNeedle(int type)
type - the type.public void setSeriesNeedle(int index,
int type)
ArrowNeedle;LineNeedle;LongNeedle;PinNeedle;PlumNeedle;PointerNeedle;ShipNeedle;WindNeedle;ArrowNeedle;MiddlePinNeedle;index - the series index.type - the needle type.public void setSeriesNeedle(int index,
org.jfree.chart.needle.MeterNeedle needle)
index - the series index.needle - the needle.public org.jfree.data.general.ValueDataset[] getDatasets()
Provided for convenience.
public void addDataset(org.jfree.data.general.ValueDataset dataset)
dataset - the new dataset.public void addDataset(org.jfree.data.general.ValueDataset dataset,
org.jfree.chart.needle.MeterNeedle needle)
dataset - the new dataset.needle - the needle.public void draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area,
java.awt.geom.Point2D anchor,
org.jfree.chart.plot.PlotState parentState,
org.jfree.chart.plot.PlotRenderingInfo info)
draw in class org.jfree.chart.plot.Plotg2 - 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.public java.lang.String getPlotType()
getPlotType in class org.jfree.chart.plot.Plotpublic org.jfree.chart.LegendItemCollection getLegendItems()
getLegendItems in interface org.jfree.chart.LegendItemSourcegetLegendItems in class org.jfree.chart.plot.Plotpublic void zoom(double percent)
zoom in class org.jfree.chart.plot.Plotpercent - the zoom amount.protected java.awt.Font getCompassFont(int radius)
radius - the radius.public boolean equals(java.lang.Object obj)
equals in class org.jfree.chart.plot.Plotobj - the object (null permitted).public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface org.jfree.util.PublicCloneableclone in class org.jfree.chart.plot.Plotjava.lang.CloneNotSupportedException - this class will not throw this exception, but subclasses (if any) might.public void setRevolutionDistance(double size)
size - the count to complete one revolution.public double getRevolutionDistance()
public void updateCardinalStrings(java.lang.String north,
java.lang.String south,
java.lang.String east,
java.lang.String west)