|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.ijchart.xychart.plot.AbstractPlot
public abstract class AbstractPlot
Title: IJChart
Description: a chart library for the Java(tm) platform.
The base class for all plots in IJChart.TheIJChart
class
delegates the drawing of axes and data to the plot.This base class provides facilities common
to most plot types.
Copyright: Copyright (c) 2013
Company:
Field Summary | |
---|---|
protected java.awt.geom.Rectangle2D |
dataArea
The data area. |
static float |
DEFAULT_BACKGROUND_ALPHA
The default background alpha transparency. |
static Align |
DEFAULT_BACKGROUND_IMAGE_ALIGNMENT
The default background image alignment. |
static java.awt.Paint |
DEFAULT_BACKGROUND_PAINT
The default background color. |
static java.awt.Paint |
DEFAULT_BORDER_PAINT
The default border color. |
static java.awt.Stroke |
DEFAULT_BORDER_STROKE
The default outline stroke. |
static boolean |
DEFAULT_BORDER_VISIBLE
A default flag that controls whether or not the plot border is drawn. |
static boolean |
DEFAULT_DRAW_NO_DATA_MESSAGE
A default flag that controls whether or not draw no data message if no data is available. |
static IDrawingSupplier |
DEFAULT_DRAWINT_SUPPLIER
The drawing supplier for this render. |
static float |
DEFAULT_FOREGROUND_ALPHA
The default foreground alpha transparency. |
static RectangleInsets |
DEFAULT_INSETS
The default insets. |
static int |
DEFAULT_MINIMUM_HEIGHT_TO_DRAW
The default minimum height at which the plot should be drawn. |
static int |
DEFAULT_MINIMUM_WIDTH_TO_DRAW
The default minimum width at which the plot should be drawn. |
static java.lang.String |
DEFAULT_NO_DATA_MESSAGE
The default message to display if no data is available. |
static java.awt.Font |
DEFAULT_NO_DATA_MESSAGE_FONT
The default font used to display the 'no data' message. |
static java.awt.Paint |
DEFAULT_NO_DATA_MESSAGE_PAINT
The paint used to draw the 'no data' message. |
static RenderDrawOrder |
DEFAULT_RENDER_CALL_ORDER
Default order for call renders. |
boolean |
drawNoDataMessage
A flag that controls whether or not draw no data message if no data is available. |
protected PlotShapeCollection |
plotShapes
Storage for plot information. |
protected RenderDrawOrder |
renderingOrder
the order for call renders. |
protected java.util.List |
renderShapesList
A list of render shape collection. |
Constructor Summary | |
---|---|
protected |
AbstractPlot()
Creates a new plot. |
Method Summary | |
---|---|
void |
addChangeListener(IPlotChangeListener 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.The plot reacts by passing on a axis change event to all registered listeners. |
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,
ChartShapeCollection chartShapes)
Draws the plot within the specified area.Subclasses need to provide an implementation of this method, obviously. |
protected void |
drawBackground(java.awt.geom.Rectangle2D plotArea,
ChartOrientation orientation,
PlotShapeCollection shapeCollection)
Fills the specified area with the background paint. |
protected void |
drawBackgroundImage(java.awt.geom.Rectangle2D plotArea,
PlotShapeCollection shapeCollection)
Draws the background image (if there is one) aligned within the specified area. |
protected void |
drawBorder(java.awt.geom.Rectangle2D plotArea,
PlotShapeCollection shapeCollection)
Draws the plot border. |
abstract boolean |
drawCrosshair(java.awt.geom.Point2D mouseClickPoint)
Draws the crosshair. |
protected void |
drawNoDataMessage(java.awt.geom.Rectangle2D plotArea,
PlotShapeCollection shapeCollection)
Draws a message to state that there is no data to plot. |
boolean |
equals(java.lang.Object obj)
Tests this plot for equality with another object. |
protected void |
firePlotChanged()
Notifies all registered listeners that the plot has changed. |
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. |
Align |
getBackgroundImageAlignment()
Returns the background image alignment. |
float |
getBackgroundImageAlpha()
Returns the alpha transparency used to draw the background image. |
java.awt.Paint |
getBackgroundPaint()
Returns the background color of the plot area. |
java.awt.Paint |
getBorderPaint()
Returns the color used to draw the border of the plot area. |
java.awt.Stroke |
getBorderStroke()
Returns the stroke used to outline the plot area. |
java.awt.geom.Point2D |
getCrosshairPoint(java.awt.geom.Point2D mouseClickPoint)
Returns the crosshair point. |
java.awt.geom.Rectangle2D |
getDataArea()
The data area. |
IDrawingSupplier |
getDrawingSupplier()
Returns the drawing supplier for this render. |
float |
getForegroundAlpha()
Returns the alpha-transparency for the plot foreground. |
RectangleInsets |
getInsets()
Returns the insets for the plot area. |
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. |
abstract PlotType |
getPlotType()
Returns a short string describing the plot type. |
RenderDrawOrder |
getRenderDrawOrder()
Returns the order for call renders. |
abstract java.util.Collection |
getRenders()
Returns the collection of renders,and this collection is unmodifiable. |
java.util.Collection |
getRenderShapesList()
Returns the list of render shape collection. |
java.util.Collection |
getSubPlots()
Returns all sub plots. |
void |
handleClick(int x,
int y,
ChartShapeCollection shapeCollection)
Handles a 'click' on the plot. |
int |
hashCode()
Returns a hash code value for the object. |
boolean |
isBorderVisible()
Returns the flag that controls whether or not the plot border is drawn. |
boolean |
isDomainZoomable()
Returns true if the plot's domain axis is zoomable, and false otherwise. |
boolean |
isDrawNoDataMessage()
Returns the flag that controls whether or not draw no data message if no data is available. |
boolean |
isValueZoomable()
Returns true if the plot's value is zoomable, and false otherwise. |
protected void |
notifyListeners(PlotChangeEvent event)
Notifies all registered listeners that the plot has been modified. |
void |
removeChangeListener(IPlotChangeListener listener)
Unregisters an object for notification of changes to the plot. |
void |
renderChanged(RenderChangeEvent event)
Receives notification of a render change event. |
static RectangleEdge |
resolveDomainAxisLocation(AxisLocation location,
ChartOrientation orientation)
Resolves a domain axis location for a given chart orientation. |
static RectangleEdge |
resolveValueAxisLocation(AxisLocation location,
ChartOrientation orientation)
Resolves a value axis location for a given chart 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 and sends a PlotChangeEvent to all registered listeners. |
void |
setBackgroundImageAlignment(Align 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(java.awt.Paint paint)
Sets the background color of the plot area and sends a PlotChangeEvent to all registered listeners. |
void |
setBorderPaint(java.awt.Paint paint)
Sets the paint used to draw the border of the plot area and sends a PlotChangeEvent to all registered listeners. |
void |
setBorderStroke(java.awt.Stroke stroke)
Sets the stroke used to outline the plot area and sends a PlotChangeEvent to all registered listeners. |
void |
setBorderVisible(boolean visible)
Sets the flag that controls whether or not the plot's border is drawn, and sends a PlotChangeEvent to all registered listeners. |
void |
setDrawingSupplier(IDrawingSupplier supplier)
Sets the drawing supplier for this render,and sends a RenderChangeEvent to all registered listeners. |
void |
setDrawNoDataMessage(boolean flag)
A flag that controls whether or not draw no data message if no data is available. |
void |
setForegroundAlpha(float alpha)
Sets the alpha-transparency for the plot and sends a PlotChangeEvent to all registered listeners. |
void |
setInsets(RectangleInsets insets)
Sets the insets for the plot and sends a PlotChangeEvent to
all registered listeners. |
protected void |
setListObject(java.util.List list,
int index,
java.lang.Object obj)
Replaces the element at the specified position in this list with the specified element. |
void |
setNoDataMessage(java.lang.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(java.awt.Font font)
Sets the font used to display the 'no data' message and sends a PlotChangeEvent to all registered listeners. |
void |
setNoDataMessagePaint(java.awt.Paint paint)
Sets the paint used to display the 'no data' message and sends a PlotChangeEvent to all registered listeners. |
void |
setRenderDrawOrder(RenderDrawOrder order)
Sets the renders call order and sends a PlotChangeEvent to all
registered listeners. |
void |
zoomDomainAxes(java.awt.geom.Rectangle2D selectArea,
java.awt.geom.Rectangle2D dataArea,
java.awt.geom.Point2D source)
Zoom domain axes. |
void |
zoomValueAxes(java.awt.geom.Rectangle2D selectArea,
java.awt.geom.Rectangle2D dataArea,
java.awt.geom.Point2D source)
Zoom value axes. |
Methods inherited from class java.lang.Object |
---|
finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Methods inherited from interface com.ijchart.xychart.plot.IZoomable |
---|
getOrientation |
Field Detail |
---|
public static final RectangleInsets DEFAULT_INSETS
public static final java.awt.Stroke DEFAULT_BORDER_STROKE
public static final java.awt.Paint DEFAULT_BORDER_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 DEFAULT_MINIMUM_WIDTH_TO_DRAW
public static final int DEFAULT_MINIMUM_HEIGHT_TO_DRAW
public static final java.lang.String DEFAULT_NO_DATA_MESSAGE
public static final java.awt.Font DEFAULT_NO_DATA_MESSAGE_FONT
public static final java.awt.Paint DEFAULT_NO_DATA_MESSAGE_PAINT
public static final boolean DEFAULT_BORDER_VISIBLE
public static final Align DEFAULT_BACKGROUND_IMAGE_ALIGNMENT
public static final boolean DEFAULT_DRAW_NO_DATA_MESSAGE
public static final IDrawingSupplier DEFAULT_DRAWINT_SUPPLIER
public static final RenderDrawOrder DEFAULT_RENDER_CALL_ORDER
public boolean drawNoDataMessage
protected RenderDrawOrder renderingOrder
protected java.util.List renderShapesList
protected java.awt.geom.Rectangle2D dataArea
protected PlotShapeCollection plotShapes
Constructor Detail |
---|
protected AbstractPlot()
Method Detail |
---|
public java.lang.String getNoDataMessage()
public void setNoDataMessage(java.lang.String message)
PlotChangeEvent
to all registered listeners.
message
-
The message (null permitted).public java.awt.Font getNoDataMessageFont()
public void setNoDataMessageFont(java.awt.Font font)
PlotChangeEvent
to all registered listeners.
font
-
The font (null not permitted).public java.awt.Paint getNoDataMessagePaint()
public void setNoDataMessagePaint(java.awt.Paint paint)
PlotChangeEvent
to all registered listeners.
paint
-
The paint (null not permitted).public abstract PlotType getPlotType()
public RectangleInsets getInsets()
public void setInsets(RectangleInsets insets)
PlotChangeEvent
to
all registered listeners.
insets
-
The new insets (null not permitted).public java.awt.Paint getBackgroundPaint()
public void setBackgroundPaint(java.awt.Paint paint)
PlotChangeEvent
to all registered listeners.
paint
-
The paint (null permitted).public float getBackgroundAlpha()
public void setBackgroundAlpha(float alpha)
alpha
-
The new alpha value (in the range 0.0f to 1.0f).public java.awt.Image getBackgroundImage()
public void setBackgroundImage(java.awt.Image image)
PlotChangeEvent
to all registered listeners.
image
-
The image (null permitted).public Align getBackgroundImageAlignment()
Align
class.
public void setBackgroundImageAlignment(Align alignment)
PlotChangeEvent
to all registered listeners. Alignment options
are defined by the Align
class.
alignment
- Align
The alignment.public float getBackgroundImageAlpha()
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).public boolean isBorderVisible()
public void setBorderVisible(boolean visible)
PlotChangeEvent
to all registered listeners.
visible
-
The new flag value.public java.awt.Stroke getBorderStroke()
public void setBorderStroke(java.awt.Stroke stroke)
PlotChangeEvent
to all registered listeners.
stroke
-
The stroke (null not permitted).public java.awt.Paint getBorderPaint()
public void setBorderPaint(java.awt.Paint paint)
PlotChangeEvent
to all registered listeners.
paint
-
The paint (null not permitted).public float getForegroundAlpha()
public void setForegroundAlpha(float alpha)
PlotChangeEvent
to all registered listeners.
alpha
-
The new alpha transparency (in the range 0.0f to 1.0f, where 0.0f is fully transparent,
and 1.0f is fully opaque).public boolean isDrawNoDataMessage()
public void setDrawNoDataMessage(boolean flag)
flag
- boolean
Returns true if draw no data message,otherwise return false.public IDrawingSupplier getDrawingSupplier()
public void setDrawingSupplier(IDrawingSupplier supplier)
RenderChangeEvent
to all registered listeners.
supplier
- IDrawingSupplier
The drawing supplier for this render (null not permitted).public abstract void draw(java.awt.Graphics2D g2, java.awt.geom.Rectangle2D plotArea, ChartShapeCollection chartShapes)
g2
- Graphics2D
The graphics device (null not permitted).plotArea
- Rectangle2D
The plot draw area (null not permitted).chartShapes
- ChartShapeCollection
Collects information about the chart (null not permitted).public abstract boolean drawCrosshair(java.awt.geom.Point2D mouseClickPoint)
mouseClickPoint
- Point2D
The mouse click point (null permitted).
public java.awt.geom.Point2D getCrosshairPoint(java.awt.geom.Point2D mouseClickPoint)
mouseClickPoint
- Point2D
The mouse click point (null permitted).
protected void drawBackground(java.awt.geom.Rectangle2D plotArea, ChartOrientation orientation, PlotShapeCollection shapeCollection)
plotArea
-
The background draw area (null not permitted).orientation
- ChartOrientation
The chart draw orientation.shapeCollection
- RenderShapeCollection
Collects information about the plot (null not permitted).protected void drawBackgroundImage(java.awt.geom.Rectangle2D plotArea, PlotShapeCollection shapeCollection)
plotArea
-
The background draw area (null not permitted).shapeCollection
- RenderShapeCollection
Collects information about the plot (null not permitted).protected void drawBorder(java.awt.geom.Rectangle2D plotArea, PlotShapeCollection shapeCollection)
plotArea
-
The background draw area (null not permitted).shapeCollection
- RenderShapeCollection
Collects information about the plot (null not permitted).protected void drawNoDataMessage(java.awt.geom.Rectangle2D plotArea, PlotShapeCollection shapeCollection)
plotArea
-
The background draw area (null not permitted).shapeCollection
- RenderShapeCollection
Collects information about the plot (null not permitted).public RenderDrawOrder getRenderDrawOrder()
public void setRenderDrawOrder(RenderDrawOrder order)
PlotChangeEvent
to all
registered listeners.
order
- RenderDrawOrder
The rendering order (null not permitted).public java.util.Collection getRenderShapesList()
public abstract java.util.Collection getRenders()
public java.awt.geom.Rectangle2D getDataArea()
public boolean isDomainZoomable()
isDomainZoomable
in interface IZoomable
public boolean isValueZoomable()
isValueZoomable
in interface IZoomable
public java.util.Collection getSubPlots()
public void zoomDomainAxes(java.awt.geom.Rectangle2D selectArea, java.awt.geom.Rectangle2D dataArea, java.awt.geom.Point2D source)
zoomDomainAxes
in interface IZoomable
selectArea
- Rectangle2D
The selected area,null to restore chart.dataArea
- Rectangle2D
The data area,null to restore chart.source
- Point2D
The source mouse point (null not permitted).public void zoomValueAxes(java.awt.geom.Rectangle2D selectArea, java.awt.geom.Rectangle2D dataArea, java.awt.geom.Point2D source)
zoomValueAxes
in interface IZoomable
selectArea
- Rectangle2D
The selected area,null to restore chart.dataArea
- Rectangle2D
The data area,null to restore chart.source
- Point2D
The source mouse point (null not permitted).public void handleClick(int x, int y, ChartShapeCollection shapeCollection)
x
- the x coordinate (in Java2D space).y
- the y coordinate (in Java2D space).shapeCollection
- an object containing information about the dimensions of
the plot.public void axisChanged(AxisChangeEvent event)
axisChanged
in interface IAxisChangeListener
event
-
Information about the event (not used here).public void datasetChanged(DatasetChangeEvent event)
datasetChanged
in interface IDatasetChangeListener
event
-
Information about the event (not used here).public void addChangeListener(IPlotChangeListener listener)
listener
-
The object to be registered (null not permitted).public void removeChangeListener(IPlotChangeListener listener)
listener
-
The object to be unregistered (null not permitted).protected void firePlotChanged()
public void renderChanged(RenderChangeEvent event)
renderChanged
in interface IRenderChangeListener
event
- RenderChangeEvent
The render change event.protected void notifyListeners(PlotChangeEvent event)
event
-
Information about the change event (null not permitted).public static RectangleEdge resolveDomainAxisLocation(AxisLocation location, ChartOrientation orientation)
location
-
The location (null not permitted).orientation
-
The chart orientation (null not permitted).
public static RectangleEdge resolveValueAxisLocation(AxisLocation location, ChartOrientation orientation)
location
-
The location (null not permitted).orientation
-
The chart orientation (null not permitted).
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object (null permitted).
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if some component of the plot does not
support cloning.protected void setListObject(java.util.List list, int index, java.lang.Object obj)
list
- List
The list (null not permitted).index
- int
The dataset index (zero-based).obj
- Object
The object (null permitted).
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |