|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.jfree.chart.plot.Plot
The base class for all plots in JFreeChart. The JFreeChart
class
delegates the drawing of axes and data to the plot. This base class provides facilities common
to most plot types.
Field Summary | |
static float |
DEFAULT_BACKGROUND_ALPHA
The default background alpha transparency. |
static java.awt.Paint |
DEFAULT_BACKGROUND_PAINT
The default background color. |
static float |
DEFAULT_FOREGROUND_ALPHA
The default foreground alpha transparency. |
static java.awt.Insets |
DEFAULT_INSETS
The default insets. |
static java.awt.Paint |
DEFAULT_OUTLINE_PAINT
The default outline color. |
static java.awt.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 java.lang.Number |
ZERO
Useful constant representing zero. |
Constructor Summary | |
protected |
Plot()
Creates a new plot. |
Method Summary | |
void |
addChangeListener(PlotChangeListener listener)
Registers an object for notification of changes to the plot. |
void |
axisChanged(AxisChangeEvent event)
Receives notification of a change to one of the plot's axes. |
java.lang.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(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D plotArea,
PlotState parentState,
PlotRenderingInfo info)
Draws the plot on a Java 2D graphics device (such as the screen or a printer). |
void |
draw(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area,
java.awt.geom.Point2D anchor,
PlotState parentState,
PlotRenderingInfo info)
Implement later to make use of anchor. |
void |
drawBackground(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area)
Draw the plot background. |
protected void |
drawNoDataMessage(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area)
Draws a message to state that there is no data to plot. |
void |
drawOutline(java.awt.Graphics2D g2,
java.awt.geom.Rectangle2D area)
Draw the plot outline |
boolean |
equals(java.lang.Object obj)
Tests this plot for equality with another object. |
float |
getBackgroundAlpha()
Returns the alpha transparency of the plot area background. |
java.awt.Image |
getBackgroundImage()
Returns the background image that is used to fill the plot's background area. |
int |
getBackgroundImageAlignment()
Returns the background image alignment. |
java.awt.Paint |
getBackgroundPaint()
Returns the background color of the plot area. |
double |
getDataAreaRatio()
Returns the data area ratio. |
DatasetGroup |
getDatasetGroup()
Returns the dataset group for the plot. |
DrawingSupplier |
getDrawingSupplier()
Returns the drawing supplier for the plot. |
float |
getForegroundAlpha()
Returns the alpha-transparency for the plot foreground. |
java.awt.Insets |
getInsets()
Returns the insets for the plot area. |
LegendItemCollection |
getLegendItems()
Returns the legend items for the plot. |
java.lang.String |
getNoDataMessage()
Returns the string that is displayed when the dataset is empty or null . |
java.awt.Font |
getNoDataMessageFont()
Returns the font used to display the 'no data' message. |
java.awt.Paint |
getNoDataMessagePaint()
Returns the paint used to display the 'no data' message. |
java.awt.Paint |
getOutlinePaint()
Returns the color used to draw the outline of the plot area. |
java.awt.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 java.lang.String |
getPlotType()
Returns a short string describing the plot type. |
protected double |
getRectX(double x,
double w1,
double w2,
org.jfree.ui.RectangleEdge edge)
Adjusts the supplied x-value. |
protected double |
getRectY(double y,
double h1,
double h2,
org.jfree.ui.RectangleEdge edge)
Adjusts the supplied y-value. |
Plot |
getRootPlot()
Returns the root plot. |
void |
handleClick(int x,
int y,
PlotRenderingInfo info)
Handles a 'click' on the plot. |
boolean |
isSubplot()
Returns true if this plot is part of a combined plot structure. |
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 domain 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(java.awt.Image image)
Sets the background image for the plot. |
void |
setBackgroundImageAlignment(int alignment)
Sets the background alignment. |
void |
setBackgroundPaint(java.awt.Paint paint)
Sets the background color of the plot area. |
void |
setDataAreaRatio(double ratio)
Sets the data area ratio. |
protected void |
setDatasetGroup(DatasetGroup group)
Sets the dataset group. |
void |
setDrawingSupplier(DrawingSupplier supplier)
Sets the drawing supplier for the plot. |
void |
setForegroundAlpha(float alpha)
Sets the alpha-transparency for the plot. |
void |
setInsets(java.awt.Insets insets)
Sets the insets for the plot and notifies registered listeners that the plot has been modified. |
void |
setInsets(java.awt.Insets insets,
boolean notify)
Sets the insets for the plot and, if requested, notifies registered listeners that the plot has been modified. |
void |
setNoDataMessage(java.lang.String message)
Sets the message that is displayed when the dataset is empty or null. |
void |
setNoDataMessageFont(java.awt.Font font)
Sets the font used to display the 'no data' message. |
void |
setNoDataMessagePaint(java.awt.Paint paint)
Sets the paint used to display the 'no data' message. |
void |
setOutlinePaint(java.awt.Paint paint)
Sets the color used to draw the outline of the plot area. |
void |
setOutlineStroke(java.awt.Stroke stroke)
Sets the stroke used to outline the plot area. |
void |
setParent(Plot parent)
Sets the parent plot. |
void |
zoom(double percent)
Performs a zoom on the plot. |
Methods inherited from class java.lang.Object |
finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final java.lang.Number ZERO
public static final java.awt.Insets DEFAULT_INSETS
public static final java.awt.Stroke DEFAULT_OUTLINE_STROKE
public static final java.awt.Paint DEFAULT_OUTLINE_PAINT
public static final float DEFAULT_FOREGROUND_ALPHA
public static final float DEFAULT_BACKGROUND_ALPHA
public static final java.awt.Paint DEFAULT_BACKGROUND_PAINT
public static final int MINIMUM_WIDTH_TO_DRAW
public static final int MINIMUM_HEIGHT_TO_DRAW
Constructor Detail |
protected Plot()
Method Detail |
public DatasetGroup getDatasetGroup()
protected void setDatasetGroup(DatasetGroup group)
group
- the dataset group.public java.lang.String getNoDataMessage()
null
.
null
possible).public void setNoDataMessage(java.lang.String message)
message
- the message (null permitted).public java.awt.Font getNoDataMessageFont()
public void setNoDataMessageFont(java.awt.Font font)
font
- the font.public java.awt.Paint getNoDataMessagePaint()
public void setNoDataMessagePaint(java.awt.Paint paint)
paint
- the paint.public abstract java.lang.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.
public Plot getParent()
public void setParent(Plot parent)
parent
- the parent plot.public Plot getRootPlot()
public boolean isSubplot()
true
if this plot is part of a combined plot structure.public java.awt.Insets getInsets()
public void setInsets(java.awt.Insets insets)
insets
- the new insets.public void setInsets(java.awt.Insets insets, boolean notify)
insets
- the new insets.notify
- a flag that controls whether the registered listeners are notified.public java.awt.Paint getBackgroundPaint()
null
).public void setBackgroundPaint(java.awt.Paint paint)
PlotChangeEvent
is forwarded to
all registered listeners.
paint
- the paint (null
permitted).public float getBackgroundAlpha()
public void setBackgroundAlpha(float alpha)
alpha
- the new alpha value.public DrawingSupplier getDrawingSupplier()
public void setDrawingSupplier(DrawingSupplier supplier)
Paint
,
Stroke
and Shape
objects that the plot's renderer(s) can use
to populate its(their) tables.
supplier
- the new supplier.public java.awt.Image getBackgroundImage()
null
).public void setBackgroundImage(java.awt.Image image)
image
- the image (null
permitted).public int getBackgroundImageAlignment()
org.jfree.ui.Align
class in the JCommon class library.
public void setBackgroundImageAlignment(int alignment)
Alignment options are defined by the Align
class.
alignment
- the alignment.public java.awt.Stroke getOutlineStroke()
null
).public void setOutlineStroke(java.awt.Stroke stroke)
PlotChangeEvent
is sent to all
registered listeners.
If you set this attribute to
null<.code>, no outline will be drawn.
stroke
- the stroke (null
permitted).
public java.awt.Paint getOutlinePaint()
null).
public void setOutlinePaint(java.awt.Paint paint)
PlotChangeEvent
is
sent to all registered listeners.
If you set this attribute to null
, no outline will be drawn.
paint
- the paint (null
permitted).public float getForegroundAlpha()
public void setForegroundAlpha(float alpha)
alpha
- the new alpha transparency.public LegendItemCollection getLegendItems()
By default, this method returns null
. Subclasses should override to return a
LegendItemCollection
.
public void addChangeListener(PlotChangeListener listener)
listener
- the object to be registered.public void removeChangeListener(PlotChangeListener listener)
listener
- the object to be unregistered.public void notifyListeners(PlotChangeEvent event)
event
- information about the change event.public abstract void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, PlotState parentState, PlotRenderingInfo info)
This class does not store any information about where the individual items that make up the plot are actually drawn. If you want to collect this information, pass in a ChartRenderingInfo object. After the drawing is complete, the info object will contain lots of information about the chart. If you don't want the information, pass in null. *
g2
- the graphics device.plotArea
- the area within which the plot should be drawn.parentState
- the state from the parent plot, if there is one.info
- an object for collecting information about the drawing of the chart.public void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area, java.awt.geom.Point2D anchor, PlotState parentState, PlotRenderingInfo info)
g2
- the graphics device.area
- the plot area.anchor
- the anchor point.parentState
- the parent state (if any).info
- carries back plot rendering info.public void drawBackground(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
g2
- the graphics device.area
- the area within which the plot should be drawn.public void drawOutline(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D area)
g2
- the graphics device.area
- the area within which the plot should be drawn.protected void drawNoDataMessage(java.awt.Graphics2D g2, java.awt.geom.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 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).protected double getRectX(double x, double w1, double w2, org.jfree.ui.RectangleEdge edge)
x
- the x-value.w1
- width 1.w2
- width 2.edge
- the edge (left or right).
protected double getRectY(double y, double h1, double h2, org.jfree.ui.RectangleEdge edge)
y
- the x-value.h1
- height 1.h2
- height 2.edge
- the edge (top or bottom).
public double getDataAreaRatio()
public void setDataAreaRatio(double ratio)
ratio
- the ratio.public boolean equals(java.lang.Object obj)
obj
- the object.
true
or false
.public java.lang.Object clone() throws java.lang.CloneNotSupportedException
java.lang.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.orientation
- the orientation.
public static org.jfree.ui.RectangleEdge resolveRangeAxisLocation(AxisLocation location, PlotOrientation orientation)
location
- the location.orientation
- the orientation.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |