public abstract class Plot extends Object implements AxisChangeListener, DatasetChangeListener, AnnotationChangeListener, MarkerChangeListener, LegendItemSource, org.jfree.util.PublicCloneable, Cloneable, Serializable
JFreeChart
class
delegates the drawing of axes and data to the plot. This base class
provides facilities common to most plot types.Modifier and Type | Field and Description |
---|---|
static float |
DEFAULT_BACKGROUND_ALPHA
The default background alpha transparency.
|
static Paint |
DEFAULT_BACKGROUND_PAINT
The default background color.
|
static float |
DEFAULT_FOREGROUND_ALPHA
The default foreground alpha transparency.
|
static org.jfree.ui.RectangleInsets |
DEFAULT_INSETS
The default insets.
|
static Shape |
DEFAULT_LEGEND_ITEM_BOX
A default box shape for legend items.
|
static Shape |
DEFAULT_LEGEND_ITEM_CIRCLE
A default circle shape for legend items.
|
static Paint |
DEFAULT_OUTLINE_PAINT
The default outline color.
|
static Stroke |
DEFAULT_OUTLINE_STROKE
The default outline stroke.
|
static int |
MINIMUM_HEIGHT_TO_DRAW
The minimum height at which the plot should be drawn.
|
static int |
MINIMUM_WIDTH_TO_DRAW
The minimum width at which the plot should be drawn.
|
static Number |
ZERO
Useful constant representing zero.
|
Modifier and Type | Method and Description |
---|---|
void |
addChangeListener(PlotChangeListener listener)
Registers an object for notification of changes to the plot.
|
void |
annotationChanged(AnnotationChangeEvent event)
Receives notification of a change to an
Annotation added to
this plot. |
void |
axisChanged(AxisChangeEvent event)
Receives notification of a change to one of the plot's axes.
|
Object |
clone()
Creates a clone of the plot.
|
void |
datasetChanged(DatasetChangeEvent event)
Receives notification of a change to the plot's dataset.
|
abstract void |
draw(Graphics2D g2,
Rectangle2D area,
Point2D anchor,
PlotState parentState,
PlotRenderingInfo info)
Draws the plot within the specified area.
|
void |
drawBackground(Graphics2D g2,
Rectangle2D area)
Draws the plot background (the background color and/or image).
|
void |
drawBackgroundImage(Graphics2D g2,
Rectangle2D area)
Draws the background image (if there is one) aligned within the
specified area.
|
void |
drawOutline(Graphics2D g2,
Rectangle2D area)
Draws the plot outline.
|
boolean |
equals(Object obj)
Tests this plot for equality with another object.
|
float |
getBackgroundAlpha()
Returns the alpha transparency of the plot area background.
|
Image |
getBackgroundImage()
Returns the background image that is used to fill the plot's background
area.
|
int |
getBackgroundImageAlignment()
Returns the background image alignment.
|
float |
getBackgroundImageAlpha()
Returns the alpha transparency used to draw the background image.
|
Paint |
getBackgroundPaint()
Returns the background color of the plot area.
|
DatasetGroup |
getDatasetGroup()
Returns the dataset group for the plot (not currently used).
|
DrawingSupplier |
getDrawingSupplier()
Returns the drawing supplier for the plot.
|
float |
getForegroundAlpha()
Returns the alpha-transparency for the plot foreground.
|
org.jfree.ui.RectangleInsets |
getInsets()
Returns the insets for the plot area.
|
LegendItemCollection |
getLegendItems()
Returns the legend items for the plot.
|
String |
getNoDataMessage()
Returns the string that is displayed when the dataset is empty or
null . |
Font |
getNoDataMessageFont()
Returns the font used to display the 'no data' message.
|
Paint |
getNoDataMessagePaint()
Returns the paint used to display the 'no data' message.
|
Paint |
getOutlinePaint()
Returns the color used to draw the outline of the plot area.
|
Stroke |
getOutlineStroke()
Returns the stroke used to outline the plot area.
|
Plot |
getParent()
Returns the parent plot (or
null if this plot is not part
of a combined plot). |
abstract String |
getPlotType()
Returns a short string describing the plot type.
|
Plot |
getRootPlot()
Returns the root plot.
|
void |
handleClick(int x,
int y,
PlotRenderingInfo info)
Handles a 'click' on the plot.
|
boolean |
isNotify()
Returns a flag that controls whether or not change events are sent to
registered listeners.
|
boolean |
isOutlineVisible()
Returns the flag that controls whether or not the plot outline is
drawn.
|
boolean |
isSubplot()
Returns
true if this plot is part of a combined plot
structure (that is, getParent() returns a non-null
value), and false otherwise. |
void |
markerChanged(MarkerChangeEvent event)
Receives notification of a change to a marker that is assigned to the
plot.
|
void |
notifyListeners(PlotChangeEvent event)
Notifies all registered listeners that the plot has been modified.
|
void |
removeChangeListener(PlotChangeListener listener)
Unregisters an object for notification of changes to the plot.
|
static org.jfree.ui.RectangleEdge |
resolveDomainAxisLocation(AxisLocation location,
PlotOrientation orientation)
Resolves a domain axis location for a given plot orientation.
|
static org.jfree.ui.RectangleEdge |
resolveRangeAxisLocation(AxisLocation location,
PlotOrientation orientation)
Resolves a range axis location for a given plot orientation.
|
void |
setBackgroundAlpha(float alpha)
Sets the alpha transparency of the plot area background, and notifies
registered listeners that the plot has been modified.
|
void |
setBackgroundImage(Image image)
Sets the background image for the plot and sends a
PlotChangeEvent to all registered listeners. |
void |
setBackgroundImageAlignment(int alignment)
Sets the alignment for the background image and sends a
PlotChangeEvent to all registered listeners. |
void |
setBackgroundImageAlpha(float alpha)
Sets the alpha transparency used when drawing the background image.
|
void |
setBackgroundPaint(Paint paint)
Sets the background color of the plot area and sends a
PlotChangeEvent to all registered listeners. |
void |
setDrawingSupplier(DrawingSupplier supplier)
Sets the drawing supplier for the plot and sends a
PlotChangeEvent to all registered listeners. |
void |
setDrawingSupplier(DrawingSupplier supplier,
boolean notify)
Sets the drawing supplier for the plot and, if requested, sends a
PlotChangeEvent to all registered listeners. |
void |
setForegroundAlpha(float alpha)
Sets the alpha-transparency for the plot and sends a
PlotChangeEvent to all registered listeners. |
void |
setInsets(org.jfree.ui.RectangleInsets insets)
Sets the insets for the plot and sends a
PlotChangeEvent to
all registered listeners. |
void |
setInsets(org.jfree.ui.RectangleInsets insets,
boolean notify)
Sets the insets for the plot and, if requested, and sends a
PlotChangeEvent to all registered listeners. |
void |
setNoDataMessage(String message)
Sets the message that is displayed when the dataset is empty or
null , and sends a PlotChangeEvent to all registered
listeners. |
void |
setNoDataMessageFont(Font font)
Sets the font used to display the 'no data' message and sends a
PlotChangeEvent to all registered listeners. |
void |
setNoDataMessagePaint(Paint paint)
Sets the paint used to display the 'no data' message and sends a
PlotChangeEvent to all registered listeners. |
void |
setNotify(boolean notify)
Sets a flag that controls whether or not listeners receive
PlotChangeEvent notifications. |
void |
setOutlinePaint(Paint paint)
Sets the paint used to draw the outline of the plot area and sends a
PlotChangeEvent to all registered listeners. |
void |
setOutlineStroke(Stroke stroke)
Sets the stroke used to outline the plot area and sends a
PlotChangeEvent to all registered listeners. |
void |
setOutlineVisible(boolean visible)
Sets the flag that controls whether or not the plot's outline is
drawn, and sends a
PlotChangeEvent to all registered listeners. |
void |
setParent(Plot parent)
Sets the parent plot.
|
void |
zoom(double percent)
Performs a zoom on the plot.
|
public static final Number ZERO
public static final org.jfree.ui.RectangleInsets DEFAULT_INSETS
public static final Stroke DEFAULT_OUTLINE_STROKE
public static final Paint DEFAULT_OUTLINE_PAINT
public static final float DEFAULT_FOREGROUND_ALPHA
public static final float DEFAULT_BACKGROUND_ALPHA
public static final Paint DEFAULT_BACKGROUND_PAINT
public static final int MINIMUM_WIDTH_TO_DRAW
public static final int MINIMUM_HEIGHT_TO_DRAW
public static final Shape DEFAULT_LEGEND_ITEM_BOX
public static final Shape DEFAULT_LEGEND_ITEM_CIRCLE
public DatasetGroup getDatasetGroup()
setDatasetGroup(DatasetGroup)
public String getNoDataMessage()
null
.null
possible).setNoDataMessage(String)
,
getNoDataMessageFont()
,
getNoDataMessagePaint()
public void setNoDataMessage(String message)
null
, and sends a PlotChangeEvent
to all registered
listeners.message
- the message (null
permitted).getNoDataMessage()
public Font getNoDataMessageFont()
null
).setNoDataMessageFont(Font)
,
getNoDataMessage()
public void setNoDataMessageFont(Font font)
PlotChangeEvent
to all registered listeners.font
- the font (null
not permitted).getNoDataMessageFont()
public Paint getNoDataMessagePaint()
null
).setNoDataMessagePaint(Paint)
,
getNoDataMessage()
public void setNoDataMessagePaint(Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the paint (null
not permitted).getNoDataMessagePaint()
public abstract String getPlotType()
Note: this gets used in the chart property editing user interface, but there needs to be a better mechanism for identifying the plot type.
null
).public Plot getParent()
null
if this plot is not part
of a combined plot).setParent(Plot)
,
getRootPlot()
public void setParent(Plot parent)
parent
- the parent plot (null
permitted).getParent()
public Plot getRootPlot()
getParent()
public boolean isSubplot()
true
if this plot is part of a combined plot
structure (that is, getParent()
returns a non-null
value), and false
otherwise.true
if this plot is part of a combined plot
structure.getParent()
public org.jfree.ui.RectangleInsets getInsets()
null
).setInsets(RectangleInsets)
public void setInsets(org.jfree.ui.RectangleInsets insets)
PlotChangeEvent
to
all registered listeners.insets
- the new insets (null
not permitted).getInsets()
,
setInsets(RectangleInsets, boolean)
public void setInsets(org.jfree.ui.RectangleInsets insets, boolean notify)
PlotChangeEvent
to all registered listeners.insets
- the new insets (null
not permitted).notify
- a flag that controls whether the registered listeners are
notified.getInsets()
,
setInsets(RectangleInsets)
public Paint getBackgroundPaint()
null
).setBackgroundPaint(Paint)
public void setBackgroundPaint(Paint paint)
PlotChangeEvent
to all registered listeners.paint
- the paint (null
permitted).getBackgroundPaint()
public float getBackgroundAlpha()
setBackgroundAlpha(float)
public void setBackgroundAlpha(float alpha)
alpha
- the new alpha value (in the range 0.0f to 1.0f).getBackgroundAlpha()
public DrawingSupplier getDrawingSupplier()
null
).setDrawingSupplier(DrawingSupplier)
public void setDrawingSupplier(DrawingSupplier supplier)
PlotChangeEvent
to all registered listeners. The drawing
supplier is responsible for supplying a limitless (possibly repeating)
sequence of Paint
, Stroke
and
Shape
objects that the plot's renderer(s) can use to
populate its (their) tables.supplier
- the new supplier.getDrawingSupplier()
public void setDrawingSupplier(DrawingSupplier supplier, boolean notify)
PlotChangeEvent
to all registered listeners. The drawing
supplier is responsible for supplying a limitless (possibly repeating)
sequence of Paint
, Stroke
and
Shape
objects that the plot's renderer(s) can use to
populate its (their) tables.supplier
- the new supplier.notify
- notify listeners?getDrawingSupplier()
public Image getBackgroundImage()
null
).setBackgroundImage(Image)
public void setBackgroundImage(Image image)
PlotChangeEvent
to all registered listeners.image
- the image (null
permitted).getBackgroundImage()
public int getBackgroundImageAlignment()
org.jfree.ui.Align
class in the JCommon class
library.setBackgroundImageAlignment(int)
public void setBackgroundImageAlignment(int alignment)
PlotChangeEvent
to all registered listeners. Alignment options
are defined by the Align
class in the JCommon
class library.alignment
- the alignment.getBackgroundImageAlignment()
public float getBackgroundImageAlpha()
setBackgroundImageAlpha(float)
public void setBackgroundImageAlpha(float alpha)
alpha
- the alpha transparency (in the range 0.0f to 1.0f, where
0.0f is fully transparent, and 1.0f is fully opaque).IllegalArgumentException
- if alpha
is not within
the specified range.getBackgroundImageAlpha()
public boolean isOutlineVisible()
true
. Note that for
historical reasons, the plot's outline paint and stroke can take on
null
values, in which case the outline will not be drawn
even if this flag is set to true
.setOutlineVisible(boolean)
public void setOutlineVisible(boolean visible)
PlotChangeEvent
to all registered listeners.visible
- the new flag value.isOutlineVisible()
public Stroke getOutlineStroke()
null
).setOutlineStroke(Stroke)
public void setOutlineStroke(Stroke stroke)
PlotChangeEvent
to all registered listeners. If you set this
attribute to null
, no outline will be drawn.stroke
- the stroke (null
permitted).getOutlineStroke()
public Paint getOutlinePaint()
null
).setOutlinePaint(Paint)
public void setOutlinePaint(Paint paint)
PlotChangeEvent
to all registered listeners. If you set this
attribute to null
, no outline will be drawn.paint
- the paint (null
permitted).getOutlinePaint()
public float getForegroundAlpha()
setForegroundAlpha(float)
public void setForegroundAlpha(float alpha)
PlotChangeEvent
to all registered listeners.alpha
- the new alpha transparency.getForegroundAlpha()
public LegendItemCollection getLegendItems()
null
. Subclasses should override to return a
LegendItemCollection
.getLegendItems
in interface LegendItemSource
null
).public boolean isNotify()
setNotify(boolean)
public void setNotify(boolean notify)
PlotChangeEvent
notifications.notify
- a boolean.isNotify()
public void addChangeListener(PlotChangeListener listener)
listener
- the object to be registered.removeChangeListener(PlotChangeListener)
public void removeChangeListener(PlotChangeListener listener)
listener
- the object to be unregistered.addChangeListener(PlotChangeListener)
public void notifyListeners(PlotChangeEvent event)
event
- information about the change event.public abstract void draw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info)
g2
- the graphics device.area
- the plot area.anchor
- the anchor point (null
permitted).parentState
- the parent state (if any).info
- carries back plot rendering info.public void drawBackground(Graphics2D g2, Rectangle2D area)
This method will be called during the chart drawing process and is declared public so that it can be accessed by the renderers used by certain subclasses. You shouldn't need to call this method directly.
g2
- the graphics device.area
- the area within which the plot should be drawn.public void drawBackgroundImage(Graphics2D g2, Rectangle2D area)
g2
- the graphics device.area
- the area.getBackgroundImage()
,
getBackgroundImageAlignment()
,
getBackgroundImageAlpha()
public void drawOutline(Graphics2D g2, Rectangle2D area)
g2
- the graphics device.area
- the area within which the plot should be drawn.public void handleClick(int x, int y, PlotRenderingInfo info)
x
- the x coordinate (in Java2D space).y
- the y coordinate (in Java2D space).info
- an object containing information about the dimensions of
the plot.public void zoom(double percent)
percent
- the zoom percentage.public void annotationChanged(AnnotationChangeEvent event)
Annotation
added to
this plot.annotationChanged
in interface AnnotationChangeListener
event
- information about the event (not used here).public void axisChanged(AxisChangeEvent event)
axisChanged
in interface AxisChangeListener
event
- information about the event (not used here).public void datasetChanged(DatasetChangeEvent event)
The plot reacts by passing on a plot change event to all registered listeners.
datasetChanged
in interface DatasetChangeListener
event
- information about the event (not used here).public void markerChanged(MarkerChangeEvent event)
markerChanged
in interface MarkerChangeListener
event
- the event.public boolean equals(Object obj)
public Object clone() throws CloneNotSupportedException
clone
in interface org.jfree.util.PublicCloneable
clone
in class Object
CloneNotSupportedException
- if some component of the plot does not
support cloning.public static org.jfree.ui.RectangleEdge resolveDomainAxisLocation(AxisLocation location, PlotOrientation orientation)
location
- the location (null
not permitted).orientation
- the orientation (null
not permitted).null
).public static org.jfree.ui.RectangleEdge resolveRangeAxisLocation(AxisLocation location, PlotOrientation orientation)
location
- the location (null
not permitted).orientation
- the orientation (null
not permitted).null
).Jas4pp 1.5 © Java Analysis Studio for Particle Physics