- java.lang.Object
-
- org.jfree.chart.plot.Plot
-
- All Implemented Interfaces:
Serializable,Cloneable,EventListener,PublicCloneable,ChartElement,AnnotationChangeListener,AxisChangeListener,MarkerChangeListener,org.jfree.chart.legend.LegendItemSource,DatasetChangeListener
- Direct Known Subclasses:
CategoryPlot,CompassPlot,DialPlot,FastScatterPlot,FlowPlot,MeterPlot,MultiplePiePlot,PiePlot,PolarPlot,SpiderWebPlot,ThermometerPlot,WaferMapPlot,XYPlot
public abstract class Plot extends Object implements ChartElement, AxisChangeListener, DatasetChangeListener, AnnotationChangeListener, MarkerChangeListener, org.jfree.chart.legend.LegendItemSource, PublicCloneable, Cloneable, Serializable
The base class for all plots in JFreeChart. TheJFreeChartclass delegates the drawing of axes and data to the plot. This base class provides facilities common to most plot types.- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static floatDEFAULT_BACKGROUND_ALPHAThe default background alpha transparency.static PaintDEFAULT_BACKGROUND_PAINTThe default background color.static floatDEFAULT_FOREGROUND_ALPHAThe default foreground alpha transparency.static RectangleInsetsDEFAULT_INSETSThe default insets.static ShapeDEFAULT_LEGEND_ITEM_BOXA default box shape for legend items.static ShapeDEFAULT_LEGEND_ITEM_CIRCLEA default circle shape for legend items.static PaintDEFAULT_OUTLINE_PAINTThe default outline color.static StrokeDEFAULT_OUTLINE_STROKEThe default outline stroke.static intMINIMUM_HEIGHT_TO_DRAWThe minimum height at which the plot should be drawn.static intMINIMUM_WIDTH_TO_DRAWThe minimum width at which the plot should be drawn.static NumberZEROUseful constant representing zero.
-
Constructor Summary
Constructors Modifier Constructor Description protectedPlot()Creates a new plot.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description voidaddChangeListener(PlotChangeListener listener)Registers an object for notification of changes to the plot.voidannotationChanged(AnnotationChangeEvent event)Receives notification of a change to anAnnotationadded to this plot.voidaxisChanged(AxisChangeEvent event)Receives notification of a change to one of the plot's axes.Objectclone()Creates a clone of the plot.protected voidcreateAndAddEntity(Rectangle2D dataArea, PlotRenderingInfo plotState, String toolTip, String urlText)Creates a plot entity that contains a reference to the plot and the data area as shape.voiddatasetChanged(DatasetChangeEvent event)Receives notification of a change to the plot's dataset.abstract voiddraw(Graphics2D g2, Rectangle2D area, Point2D anchor, PlotState parentState, PlotRenderingInfo info)Draws the plot within the specified area.voiddrawBackground(Graphics2D g2, Rectangle2D area)Draws the plot background (the background color and/or image).voiddrawBackgroundImage(Graphics2D g2, Rectangle2D area)Draws the background image (if there is one) aligned within the specified area.protected voiddrawNoDataMessage(Graphics2D g2, Rectangle2D area)Draws a message to state that there is no data to plot.voiddrawOutline(Graphics2D g2, Rectangle2D area)Draws the plot outline.booleanequals(Object obj)Tests this plot for equality with another object.booleanfetchElementHintingFlag()Fetches the element hinting flag from the chart that this plot is assigned to.protected voidfillBackground(Graphics2D g2, Rectangle2D area)Fills the specified area with the background paint.protected voidfillBackground(Graphics2D g2, Rectangle2D area, PlotOrientation orientation)Fills the specified area with the background paint.protected voidfireChangeEvent()Sends aPlotChangeEventto all registered listeners.floatgetBackgroundAlpha()Returns the alpha transparency of the plot area background.ImagegetBackgroundImage()Returns the background image that is used to fill the plot's background area.RectangleAlignmentgetBackgroundImageAlignment()Returns the background image alignment.floatgetBackgroundImageAlpha()Returns the alpha transparency used to draw the background image.PaintgetBackgroundPaint()Returns the background color of the plot area.JFreeChartgetChart()Returns the chart that this plot is assigned to.DrawingSuppliergetDrawingSupplier()Returns the drawing supplier for the plot.floatgetForegroundAlpha()Returns the alpha-transparency for the plot foreground.RectangleInsetsgetInsets()Returns the insets for the plot area.org.jfree.chart.legend.LegendItemCollectiongetLegendItems()Returns the legend items for the plot.StringgetNoDataMessage()Returns the string that is displayed when the dataset is empty ornull.FontgetNoDataMessageFont()Returns the font used to display the 'no data' message.PaintgetNoDataMessagePaint()Returns the paint used to display the 'no data' message.PaintgetOutlinePaint()Returns the color used to draw the outline of the plot area.StrokegetOutlineStroke()Returns the stroke used to outline the plot area.PlotgetParent()Returns the parent plot (ornullif this plot is not part of a combined plot).abstract StringgetPlotType()Returns a short string describing the plot type.protected doublegetRectX(double x, double w1, double w2, RectangleEdge edge)Adjusts the supplied x-value.protected doublegetRectY(double y, double h1, double h2, RectangleEdge edge)Adjusts the supplied y-value.PlotgetRootPlot()Returns the root plot.voidhandleClick(int x, int y, PlotRenderingInfo info)Handles a 'click' on the plot.booleanisNotify()Returns a flag that controls whether or not change events are sent to registered listeners.booleanisOutlineVisible()Returns the flag that controls whether or not the plot outline is drawn.booleanisSubplot()Returnstrueif this plot is part of a combined plot structure (that is,getParent()returns a non-nullvalue), andfalseotherwise.voidmarkerChanged(MarkerChangeEvent event)Receives notification of a change to a marker that is assigned to the plot.voidnotifyListeners(PlotChangeEvent event)Notifies all registered listeners that the plot has been modified.voidreceive(ChartElementVisitor visitor)Receives a chart element visitor.voidremoveChangeListener(PlotChangeListener listener)Unregisters an object for notification of changes to the plot.static RectangleEdgeresolveDomainAxisLocation(AxisLocation location, PlotOrientation orientation)Resolves a domain axis location for a given plot orientation.static RectangleEdgeresolveRangeAxisLocation(AxisLocation location, PlotOrientation orientation)Resolves a range axis location for a given plot orientation.voidsetBackgroundAlpha(float alpha)Sets the alpha transparency of the plot area background, and notifies registered listeners that the plot has been modified.voidsetBackgroundImage(Image image)Sets the background image for the plot and sends aPlotChangeEventto all registered listeners.voidsetBackgroundImageAlignment(RectangleAlignment alignment)Sets the alignment for the background image and sends aPlotChangeEventto all registered listeners.voidsetBackgroundImageAlpha(float alpha)Sets the alpha transparency used when drawing the background image.voidsetBackgroundPaint(Paint paint)Sets the background color of the plot area and sends aPlotChangeEventto all registered listeners.voidsetChart(JFreeChart chart)Sets the chart that the plot is assigned to.voidsetDrawingSupplier(DrawingSupplier supplier)Sets the drawing supplier for the plot and sends aPlotChangeEventto all registered listeners.voidsetDrawingSupplier(DrawingSupplier supplier, boolean notify)Sets the drawing supplier for the plot and, if requested, sends aPlotChangeEventto all registered listeners.voidsetForegroundAlpha(float alpha)Sets the alpha-transparency for the plot and sends aPlotChangeEventto all registered listeners.voidsetInsets(RectangleInsets insets)Sets the insets for the plot and sends aPlotChangeEventto all registered listeners.voidsetInsets(RectangleInsets insets, boolean notify)Sets the insets for the plot and, if requested, and sends aPlotChangeEventto all registered listeners.voidsetNoDataMessage(String message)Sets the message that is displayed when the dataset is empty ornull, and sends aPlotChangeEventto all registered listeners.voidsetNoDataMessageFont(Font font)Sets the font used to display the 'no data' message and sends aPlotChangeEventto all registered listeners.voidsetNoDataMessagePaint(Paint paint)Sets the paint used to display the 'no data' message and sends aPlotChangeEventto all registered listeners.voidsetNotify(boolean notify)Sets a flag that controls whether or not listeners receivePlotChangeEventnotifications.voidsetOutlinePaint(Paint paint)Sets the paint used to draw the outline of the plot area and sends aPlotChangeEventto all registered listeners.voidsetOutlineStroke(Stroke stroke)Sets the stroke used to outline the plot area and sends aPlotChangeEventto all registered listeners.voidsetOutlineVisible(boolean visible)Sets the flag that controls whether or not the plot's outline is drawn, and sends aPlotChangeEventto all registered listeners.voidsetParent(Plot parent)Sets the parent plot.voidzoom(double percent)Performs a zoom on the plot.
-
-
-
Field Detail
-
DEFAULT_INSETS
public static final RectangleInsets DEFAULT_INSETS
The default insets.
-
DEFAULT_OUTLINE_STROKE
public static final Stroke DEFAULT_OUTLINE_STROKE
The default outline stroke.
-
DEFAULT_OUTLINE_PAINT
public static final Paint DEFAULT_OUTLINE_PAINT
The default outline color.
-
DEFAULT_FOREGROUND_ALPHA
public static final float DEFAULT_FOREGROUND_ALPHA
The default foreground alpha transparency.- See Also:
- Constant Field Values
-
DEFAULT_BACKGROUND_ALPHA
public static final float DEFAULT_BACKGROUND_ALPHA
The default background alpha transparency.- See Also:
- Constant Field Values
-
DEFAULT_BACKGROUND_PAINT
public static final Paint DEFAULT_BACKGROUND_PAINT
The default background color.
-
MINIMUM_WIDTH_TO_DRAW
public static final int MINIMUM_WIDTH_TO_DRAW
The minimum width at which the plot should be drawn.- See Also:
- Constant Field Values
-
MINIMUM_HEIGHT_TO_DRAW
public static final int MINIMUM_HEIGHT_TO_DRAW
The minimum height at which the plot should be drawn.- See Also:
- Constant Field Values
-
DEFAULT_LEGEND_ITEM_BOX
public static final Shape DEFAULT_LEGEND_ITEM_BOX
A default box shape for legend items.
-
DEFAULT_LEGEND_ITEM_CIRCLE
public static final Shape DEFAULT_LEGEND_ITEM_CIRCLE
A default circle shape for legend items.
-
-
Constructor Detail
-
Plot
protected Plot()
Creates a new plot.
-
-
Method Detail
-
getChart
public JFreeChart getChart()
Returns the chart that this plot is assigned to. This method can returnnullif the plot is not yet assigned to a plot, or if the plot is a subplot of another plot.- Returns:
- The chart (possibly
null).
-
setChart
public void setChart(JFreeChart chart)
Sets the chart that the plot is assigned to. This method is not intended for external use.- Parameters:
chart- the chart (nullpermitted).
-
fetchElementHintingFlag
public boolean fetchElementHintingFlag()
Fetches the element hinting flag from the chart that this plot is assigned to. If the plot is not assigned (directly or indirectly) to a chart instance, this method will returnfalse.- Returns:
- A boolean.
-
getNoDataMessage
public String getNoDataMessage()
Returns the string that is displayed when the dataset is empty ornull.- Returns:
- The 'no data' message (
nullpossible). - See Also:
setNoDataMessage(String),getNoDataMessageFont(),getNoDataMessagePaint()
-
setNoDataMessage
public void setNoDataMessage(String message)
Sets the message that is displayed when the dataset is empty ornull, and sends aPlotChangeEventto all registered listeners.- Parameters:
message- the message (nullpermitted).- See Also:
getNoDataMessage()
-
getNoDataMessageFont
public Font getNoDataMessageFont()
Returns the font used to display the 'no data' message.- Returns:
- The font (never
null). - See Also:
setNoDataMessageFont(Font),getNoDataMessage()
-
setNoDataMessageFont
public void setNoDataMessageFont(Font font)
Sets the font used to display the 'no data' message and sends aPlotChangeEventto all registered listeners.- Parameters:
font- the font (nullnot permitted).- See Also:
getNoDataMessageFont()
-
getNoDataMessagePaint
public Paint getNoDataMessagePaint()
Returns the paint used to display the 'no data' message.- Returns:
- The paint (never
null). - See Also:
setNoDataMessagePaint(Paint),getNoDataMessage()
-
setNoDataMessagePaint
public void setNoDataMessagePaint(Paint paint)
Sets the paint used to display the 'no data' message and sends aPlotChangeEventto all registered listeners.- Parameters:
paint- the paint (nullnot permitted).- See Also:
getNoDataMessagePaint()
-
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.
- Returns:
- A short string describing the plot type (never
null).
-
getParent
public Plot getParent()
Returns the parent plot (ornullif this plot is not part of a combined plot).- Returns:
- The parent plot.
- See Also:
setParent(Plot),getRootPlot()
-
setParent
public void setParent(Plot parent)
Sets the parent plot. This method is intended for internal use, you shouldn't need to call it directly.- Parameters:
parent- the parent plot (nullpermitted).- See Also:
getParent()
-
getRootPlot
public Plot getRootPlot()
Returns the root plot.- Returns:
- The root plot.
- See Also:
getParent()
-
isSubplot
public boolean isSubplot()
Returnstrueif this plot is part of a combined plot structure (that is,getParent()returns a non-nullvalue), andfalseotherwise.- Returns:
trueif this plot is part of a combined plot structure.- See Also:
getParent()
-
getInsets
public RectangleInsets getInsets()
Returns the insets for the plot area.- Returns:
- The insets (never
null). - See Also:
setInsets(RectangleInsets)
-
setInsets
public void setInsets(RectangleInsets insets)
Sets the insets for the plot and sends aPlotChangeEventto all registered listeners.- Parameters:
insets- the new insets (nullnot permitted).- See Also:
getInsets(),setInsets(RectangleInsets, boolean)
-
setInsets
public void setInsets(RectangleInsets insets, boolean notify)
Sets the insets for the plot and, if requested, and sends aPlotChangeEventto all registered listeners.- Parameters:
insets- the new insets (nullnot permitted).notify- a flag that controls whether the registered listeners are notified.- See Also:
getInsets(),setInsets(RectangleInsets)
-
getBackgroundPaint
public Paint getBackgroundPaint()
Returns the background color of the plot area.- Returns:
- The paint (possibly
null). - See Also:
setBackgroundPaint(Paint)
-
setBackgroundPaint
public void setBackgroundPaint(Paint paint)
Sets the background color of the plot area and sends aPlotChangeEventto all registered listeners.- Parameters:
paint- the paint (nullpermitted).- See Also:
getBackgroundPaint()
-
getBackgroundAlpha
public float getBackgroundAlpha()
Returns the alpha transparency of the plot area background.- Returns:
- The alpha transparency.
- See Also:
setBackgroundAlpha(float)
-
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.- Parameters:
alpha- the new alpha value (in the range 0.0f to 1.0f).- See Also:
getBackgroundAlpha()
-
getDrawingSupplier
public DrawingSupplier getDrawingSupplier()
Returns the drawing supplier for the plot.- Returns:
- The drawing supplier (possibly
null). - See Also:
setDrawingSupplier(DrawingSupplier)
-
setDrawingSupplier
public void setDrawingSupplier(DrawingSupplier supplier)
Sets the drawing supplier for the plot and sends aPlotChangeEventto all registered listeners. The drawing supplier is responsible for supplying a limitless (possibly repeating) sequence ofPaint,StrokeandShapeobjects that the plot's renderer(s) can use to populate its (their) tables.- Parameters:
supplier- the new supplier.- See Also:
getDrawingSupplier()
-
setDrawingSupplier
public void setDrawingSupplier(DrawingSupplier supplier, boolean notify)
Sets the drawing supplier for the plot and, if requested, sends aPlotChangeEventto all registered listeners. The drawing supplier is responsible for supplying a limitless (possibly repeating) sequence ofPaint,StrokeandShapeobjects that the plot's renderer(s) can use to populate its (their) tables.- Parameters:
supplier- the new supplier.notify- notify listeners?- See Also:
getDrawingSupplier()
-
getBackgroundImage
public Image getBackgroundImage()
Returns the background image that is used to fill the plot's background area.- Returns:
- The image (possibly
null). - See Also:
setBackgroundImage(Image)
-
setBackgroundImage
public void setBackgroundImage(Image image)
Sets the background image for the plot and sends aPlotChangeEventto all registered listeners.- Parameters:
image- the image (nullpermitted).- See Also:
getBackgroundImage()
-
getBackgroundImageAlignment
public RectangleAlignment getBackgroundImageAlignment()
Returns the background image alignment. The default value isRectangleAlignment.FILL.- Returns:
- The alignment (never
null). - See Also:
setBackgroundImageAlignment(RectangleAlignment)
-
setBackgroundImageAlignment
public void setBackgroundImageAlignment(RectangleAlignment alignment)
Sets the alignment for the background image and sends aPlotChangeEventto all registered listeners.- Parameters:
alignment- the alignment (nullnot permitted).- See Also:
getBackgroundImageAlignment()
-
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.- Returns:
- The alpha transparency.
- See Also:
setBackgroundImageAlpha(float)
-
setBackgroundImageAlpha
public void setBackgroundImageAlpha(float alpha)
Sets the alpha transparency used when drawing the background image.- Parameters:
alpha- the alpha transparency (in the range 0.0f to 1.0f, where 0.0f is fully transparent, and 1.0f is fully opaque).- Throws:
IllegalArgumentException- ifalphais not within the specified range.- See Also:
getBackgroundImageAlpha()
-
isOutlineVisible
public boolean isOutlineVisible()
Returns the flag that controls whether or not the plot outline is drawn. The default value istrue. Note that for historical reasons, the plot's outline paint and stroke can take onnullvalues, in which case the outline will not be drawn even if this flag is set totrue.- Returns:
- The outline visibility flag.
- See Also:
setOutlineVisible(boolean)
-
setOutlineVisible
public void setOutlineVisible(boolean visible)
Sets the flag that controls whether or not the plot's outline is drawn, and sends aPlotChangeEventto all registered listeners.- Parameters:
visible- the new flag value.- See Also:
isOutlineVisible()
-
getOutlineStroke
public Stroke getOutlineStroke()
Returns the stroke used to outline the plot area.- Returns:
- The stroke (possibly
null). - See Also:
setOutlineStroke(Stroke)
-
setOutlineStroke
public void setOutlineStroke(Stroke stroke)
Sets the stroke used to outline the plot area and sends aPlotChangeEventto all registered listeners. If you set this attribute tonull, no outline will be drawn.- Parameters:
stroke- the stroke (nullpermitted).- See Also:
getOutlineStroke()
-
getOutlinePaint
public Paint getOutlinePaint()
Returns the color used to draw the outline of the plot area.- Returns:
- The color (possibly
null). - See Also:
setOutlinePaint(Paint)
-
setOutlinePaint
public void setOutlinePaint(Paint paint)
Sets the paint used to draw the outline of the plot area and sends aPlotChangeEventto all registered listeners. If you set this attribute tonull, no outline will be drawn.- Parameters:
paint- the paint (nullpermitted).- See Also:
getOutlinePaint()
-
getForegroundAlpha
public float getForegroundAlpha()
Returns the alpha-transparency for the plot foreground.- Returns:
- The alpha-transparency.
- See Also:
setForegroundAlpha(float)
-
setForegroundAlpha
public void setForegroundAlpha(float alpha)
Sets the alpha-transparency for the plot and sends aPlotChangeEventto all registered listeners.- Parameters:
alpha- the new alpha transparency.- See Also:
getForegroundAlpha()
-
getLegendItems
public org.jfree.chart.legend.LegendItemCollection getLegendItems()
Returns the legend items for the plot. By default, this method returnsnull. Subclasses should override to return aLegendItemCollection.- Specified by:
getLegendItemsin interfaceorg.jfree.chart.legend.LegendItemSource- Returns:
- The legend items for the plot (possibly
null).
-
isNotify
public boolean isNotify()
Returns a flag that controls whether or not change events are sent to registered listeners.- Returns:
- A boolean.
- See Also:
setNotify(boolean)
-
setNotify
public void setNotify(boolean notify)
Sets a flag that controls whether or not listeners receivePlotChangeEventnotifications.- Parameters:
notify- a boolean.- See Also:
isNotify()
-
addChangeListener
public void addChangeListener(PlotChangeListener listener)
Registers an object for notification of changes to the plot.- Parameters:
listener- the object to be registered.- See Also:
removeChangeListener(PlotChangeListener)
-
removeChangeListener
public void removeChangeListener(PlotChangeListener listener)
Unregisters an object for notification of changes to the plot.- Parameters:
listener- the object to be unregistered.- See Also:
addChangeListener(PlotChangeListener)
-
notifyListeners
public void notifyListeners(PlotChangeEvent event)
Notifies all registered listeners that the plot has been modified.- Parameters:
event- information about the change event.
-
fireChangeEvent
protected void fireChangeEvent()
Sends aPlotChangeEventto all registered listeners.
-
receive
public void receive(ChartElementVisitor visitor)
Receives a chart element visitor. Many plot subclasses will override this method to handle their subcomponents.- Specified by:
receivein interfaceChartElement- Parameters:
visitor- the visitor (nullnot permitted).
-
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.- Parameters:
g2- the graphics device.area- the plot area.anchor- the anchor point (nullpermitted).parentState- the parent state (if any,nullpermitted).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.
- Parameters:
g2- the graphics device.area- the area within which the plot should be drawn.
-
fillBackground
protected void fillBackground(Graphics2D g2, Rectangle2D area)
Fills the specified area with the background paint.- Parameters:
g2- the graphics device.area- the area.- See Also:
getBackgroundPaint(),getBackgroundAlpha(),fillBackground(Graphics2D, Rectangle2D, PlotOrientation)
-
fillBackground
protected void fillBackground(Graphics2D g2, Rectangle2D area, PlotOrientation orientation)
Fills the specified area with the background paint. If the background paint is an instance ofGradientPaint, the gradient will run in the direction suggested by the plot's orientation.- Parameters:
g2- the graphics target.area- the plot area.orientation- the plot orientation (nullnot permitted).
-
drawBackgroundImage
public void drawBackgroundImage(Graphics2D g2, Rectangle2D area)
Draws the background image (if there is one) aligned within the specified area.- Parameters:
g2- the graphics device.area- the area.- See Also:
getBackgroundImage(),getBackgroundImageAlignment(),getBackgroundImageAlpha()
-
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.- Parameters:
g2- the graphics device.area- the area within which the plot should be drawn.
-
drawNoDataMessage
protected void drawNoDataMessage(Graphics2D g2, Rectangle2D area)
Draws a message to state that there is no data to plot.- Parameters:
g2- the graphics device.area- the area within which the plot should be drawn.
-
createAndAddEntity
protected void createAndAddEntity(Rectangle2D dataArea, PlotRenderingInfo plotState, String toolTip, String urlText)
Creates a plot entity that contains a reference to the plot and the data area as shape.- Parameters:
dataArea- the data area used as hot spot for the entity.plotState- the plot rendering info containing a reference to the EntityCollection.toolTip- the tool tip (defined in the respective Plot subclass) (nullpermitted).urlText- the url (defined in the respective Plot subclass) (nullpermitted).
-
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 so that the plot dimensions can be determined.- Parameters:
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.
-
zoom
public void zoom(double percent)
Performs a zoom on the plot. Subclasses should override if zooming is appropriate for the type of plot.- Parameters:
percent- the zoom percentage.
-
annotationChanged
public void annotationChanged(AnnotationChangeEvent event)
Receives notification of a change to anAnnotationadded to this plot.- Specified by:
annotationChangedin interfaceAnnotationChangeListener- Parameters:
event- information about the event (not used here).
-
axisChanged
public void axisChanged(AxisChangeEvent event)
Receives notification of a change to one of the plot's axes.- Specified by:
axisChangedin interfaceAxisChangeListener- Parameters:
event- information about the event (not used here).
-
datasetChanged
public void datasetChanged(DatasetChangeEvent event)
Receives notification of a change to the plot's dataset.The plot reacts by passing on a plot change event to all registered listeners.
- Specified by:
datasetChangedin interfaceDatasetChangeListener- Parameters:
event- information about the event (not used here).
-
markerChanged
public void markerChanged(MarkerChangeEvent event)
Receives notification of a change to a marker that is assigned to the plot.- Specified by:
markerChangedin interfaceMarkerChangeListener- Parameters:
event- the event.
-
getRectX
protected double getRectX(double x, double w1, double w2, RectangleEdge edge)
Adjusts the supplied x-value.- Parameters:
x- the x-value.w1- width 1.w2- width 2.edge- the edge (left or right).- Returns:
- The adjusted x-value.
-
getRectY
protected double getRectY(double y, double h1, double h2, RectangleEdge edge)
Adjusts the supplied y-value.- Parameters:
y- the x-value.h1- height 1.h2- height 2.edge- the edge (top or bottom).- Returns:
- The adjusted y-value.
-
clone
public Object clone() throws CloneNotSupportedException
Creates a clone of the plot.- Specified by:
clonein interfacePublicCloneable- Overrides:
clonein classObject- Returns:
- A clone.
- Throws:
CloneNotSupportedException- if some component of the plot does not support cloning.
-
resolveDomainAxisLocation
public static RectangleEdge resolveDomainAxisLocation(AxisLocation location, PlotOrientation orientation)
Resolves a domain axis location for a given plot orientation.- Parameters:
location- the location (nullnot permitted).orientation- the orientation (nullnot permitted).- Returns:
- The edge (never
null).
-
resolveRangeAxisLocation
public static RectangleEdge resolveRangeAxisLocation(AxisLocation location, PlotOrientation orientation)
Resolves a range axis location for a given plot orientation.- Parameters:
location- the location (nullnot permitted).orientation- the orientation (nullnot permitted).- Returns:
- The edge (never
null).
-
-