DEFAULT_INSETS
public static final RectangleInsets DEFAULT_INSETS
The default insets.
MINIMUM_HEIGHT_TO_DRAW
public static final int MINIMUM_HEIGHT_TO_DRAW
The minimum height at which the plot should be drawn.
MINIMUM_WIDTH_TO_DRAW
public static final int MINIMUM_WIDTH_TO_DRAW
The minimum width at which the plot should be drawn.
ZERO
public static final Number ZERO
Useful constant representing zero.
addChangeListener
public void addChangeListener(PlotChangeListener listener)
Registers an object for notification of changes to the plot.
listener
- the object to be registered.
clone
public Object clone()
throws CloneNotSupportedException
Creates a clone of the plot.
draw
public abstract void draw(Graphics2D g2,
Rectangle2D area,
Point2D anchor,
PlotState parentState,
PlotRenderingInfo info)
Draws the plot within the specified area. The anchor is a point on the
chart that is specified externally (for instance, it may be the last
point of the last mouse click performed by the user) - plots can use or
ignore this value as they see fit.
Subclasses need to provide an implementation of this method, obviously.
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.
drawBackground
public void drawBackground(Graphics2D g2,
Rectangle2D area)
Draws the plot background (the background color and/or image).
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.
drawBackgroundImage
protected void drawBackgroundImage(Graphics2D g2,
Rectangle2D area)
Draws the background image (if there is one) aligned within the
specified area.
g2
- the graphics device.area
- the area.
drawNoDataMessage
protected void drawNoDataMessage(Graphics2D g2,
Rectangle2D area)
Draws a message to state that there is no data to plot.
g2
- the graphics device.area
- the area within which the plot should be drawn.
drawOutline
public void drawOutline(Graphics2D g2,
Rectangle2D area)
Draws the plot outline. 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.
equals
public boolean equals(Object obj)
Tests this plot for equality with another object.
obj
- the object (null
permitted).
fillBackground
protected void fillBackground(Graphics2D g2,
Rectangle2D area)
Fills the specified area with the background paint.
g2
- the graphics device.area
- the area.
getBackgroundAlpha
public float getBackgroundAlpha()
Returns the alpha transparency of the plot area background.
getBackgroundImage
public Image getBackgroundImage()
Returns the background image that is used to fill the plot's background
area.
- The image (possibly
null
).
getBackgroundImageAlignment
public int getBackgroundImageAlignment()
Returns the background image alignment. Alignment constants are defined
in the org.jfree.ui.Align
class in the JCommon class
library.
getBackgroundImageAlpha
public float getBackgroundImageAlpha()
Returns the alpha transparency used to draw the background image. This
is a value in the range 0.0f to 1.0f, where 0.0f is fully transparent
and 1.0f is fully opaque.
getBackgroundPaint
public Paint getBackgroundPaint()
Returns the background color of the plot area.
- The paint (possibly
null
).
getForegroundAlpha
public float getForegroundAlpha()
Returns the alpha-transparency for the plot foreground.
getInsets
public RectangleInsets getInsets()
Returns the insets for the plot area.
getNoDataMessage
public String getNoDataMessage()
Returns the string that is displayed when the dataset is empty or
null
.
- The 'no data' message (
null
possible).
getNoDataMessageFont
public Font getNoDataMessageFont()
Returns the font used to display the 'no data' message.
getNoDataMessagePaint
public Paint getNoDataMessagePaint()
Returns the paint used to display the 'no data' message.
getOutlinePaint
public Paint getOutlinePaint()
Returns the color used to draw the outline of the plot area.
- The color (possibly
null
).
getOutlineStroke
public Stroke getOutlineStroke()
Returns the stroke used to outline the plot area.
- The stroke (possibly
null
).
getParent
public Plot getParent()
Returns the parent plot (or null
if this plot is not part
of a combined plot).
getPlotType
public abstract String getPlotType()
Returns a short string describing the plot type.
Note: this gets used in the chart property editing user interface,
but there needs to be a better mechanism for identifying the plot type.
- A short string describing the plot type.
getRectX
protected double getRectX(double x,
double w1,
double w2,
RectangleEdge edge)
Adjusts the supplied x-value.
x
- the x-value.w1
- width 1.w2
- width 2.edge
- the edge (left or right).
getRectY
protected double getRectY(double y,
double h1,
double h2,
RectangleEdge edge)
Adjusts the supplied y-value.
y
- the x-value.h1
- height 1.h2
- height 2.edge
- the edge (top or bottom).
handleClick
public void handleClick(int x,
int y,
PlotRenderingInfo info)
Handles a 'click' on the plot. Since the plot does not maintain any
information about where it has been drawn, the plot rendering info is
supplied as an argument.
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.
isSubplot
public boolean isSubplot()
Returns true if this plot is part of a combined plot structure.
true
if this plot is part of a combined plot
structure.
notifyListeners
public void notifyListeners(PlotChangeEvent event)
Notifies all registered listeners that the plot has been modified.
event
- information about the change event.
resolveDomainAxisLocation
public static RectangleEdge resolveDomainAxisLocation(AxisLocation location,
PlotOrientation orientation)
Resolves a domain axis location for a given plot orientation.
location
- the location (null
not permitted).orientation
- the orientation (null
not permitted).
resolveRangeAxisLocation
public static RectangleEdge resolveRangeAxisLocation(AxisLocation location,
PlotOrientation orientation)
Resolves a range axis location for a given plot orientation.
location
- the location (null
not permitted).orientation
- the orientation (null
not permitted).
setBackgroundAlpha
public void setBackgroundAlpha(float alpha)
Sets the alpha transparency of the plot area background, and notifies
registered listeners that the plot has been modified.
alpha
- the new alpha value.
setBackgroundImage
public void setBackgroundImage(Image image)
Sets the background image for the plot.
image
- the image (null
permitted).
setBackgroundImageAlignment
public void setBackgroundImageAlignment(int alignment)
Sets the alignment for the background image and sends a
PlotChangeEvent
to all registered listeners. Alignment options
are defined by the
org.jfree.ui.Align
class in the JCommon
class library.
alignment
- the alignment.
setBackgroundImageAlpha
public void setBackgroundImageAlpha(float alpha)
Sets the alpha transparency used when drawing the background image.
alpha
- the alpha transparency (in the range 0.0f to 1.0f, where
0.0f is fully transparent, and 1.0f is fully opaque).
setBackgroundPaint
public void setBackgroundPaint(Paint paint)
Sets the background color of the plot area and sends a
PlotChangeEvent
to all registered listeners.
paint
- the paint (null
permitted).
setDatasetGroup
protected void setDatasetGroup(DatasetGroup group)
Sets the dataset group (not currently used).
group
- the dataset group (null
permitted).
setDrawingSupplier
public void setDrawingSupplier(DrawingSupplier supplier)
Sets the drawing supplier for the plot. 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.
setForegroundAlpha
public void setForegroundAlpha(float alpha)
Sets the alpha-transparency for the plot.
alpha
- the new alpha transparency.
setInsets
public void setInsets(RectangleInsets insets)
Sets the insets for the plot and sends a
PlotChangeEvent
to
all registered listeners.
insets
- the new insets (null
not permitted).
setInsets
public void setInsets(RectangleInsets insets,
boolean notify)
Sets the insets for the plot and, if requested, and sends a
PlotChangeEvent
to all registered listeners.
insets
- the new insets (null
not permitted).notify
- a flag that controls whether the registered listeners are
notified.
setNoDataMessage
public void setNoDataMessage(String message)
Sets the message that is displayed when the dataset is empty or null.
message
- the message (null permitted).
setNoDataMessageFont
public void setNoDataMessageFont(Font font)
Sets the font used to display the 'no data' message.
setNoDataMessagePaint
public void setNoDataMessagePaint(Paint paint)
Sets the paint used to display the 'no data' message.
setOutlinePaint
public void setOutlinePaint(Paint paint)
Sets the paint used to draw the outline of the plot area and sends a
PlotChangeEvent
to all registered listeners. If you set this
attribute to
null
, no outline will be drawn.
paint
- the paint (null
permitted).
setOutlineStroke
public void setOutlineStroke(Stroke stroke)
Sets the stroke used to outline the plot area and sends a
PlotChangeEvent
to all registered listeners. If you set this
attribute to
null<.code>, no outline will be drawn.
stroke
- the stroke (null
permitted).
setParent
public void setParent(Plot parent)
Sets the parent plot.
parent
- the parent plot.
zoom
public void zoom(double percent)
Performs a zoom on the plot. Subclasses should override if zooming is
appropriate for the type of plot.
percent
- the zoom percentage.